简体   繁体   English

源jar从哪里加载到Axis Web服务中?

[英]From where does the source jar load in Axis webservice?

So I have this axis2-based webservice in aar-file which I build myself with ant. 因此,我在用ant构建自己的aar文件中有基于axis2的Web服务。 when I build it I specify jar files location. 构建它时,我指定了jar文件的位置。 Particularly "rt.jar", I place it inside my lib folder and build my classes with javac. 特别是“ rt.jar”,我将其放在我的lib文件夹中,并使用javac构建类。 When I delete rt.jar from my lib folder javac does not build, so I know that jar file is used. 当我从我的lib文件夹中删除rt.jar时,javac无法构建,因此我知道使用了jar文件。

The problem is when I debug my webservice and try to understand where my WSBindingProvider class loads from using code below, it says that is loads from c:/program files/java/jre1.8/... even thought I do not use jre (not jdk) libraries anywhere inside my project. 问题是当我调试我的Web服务并尝试从下面的代码了解WSBindingProvider类的加载位置时,它说这是从c:/ program files / java / jre1.8 / ...加载的,甚至以为我不使用jre (不是jdk)库在我项目的任何地方。

Can anybody explain how does it work when certain class being used in build class file? 有人可以解释在构建类文件中使用某些类时它是如何工作的吗? Is Axis takes it from jre somehow? Axis是否以某种方式从jre那里获得了它? Or maybe tomcat? 还是tomcat?

Class klass = WSBindingProvider.class;
URL location = klass.getResource('/' + klass.getName().replace('.', '/') + ".class");

The classes from rt.jar are always used both by the JRE and javac . JRE和javac始终使用rt.jar中的类。 If your code only compiles if you add rt.jar to the class path, then that means that the rt.jar in question is from a different Java version than javac. 如果仅在将rt.jar添加到类路径的情况下编译代码,那么这意味着存在问题的rt.jar来自与Javac不同的Java版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM