简体   繁体   English

Eclipse不会导入所有Axis2 jar,但是项目仍在Tomcat上运行吗?

[英]Eclipse doesn't import all Axis2 jars but project still runs on Tomcat?

When I develop an Axis2 web service on Eclipse, I noticed that Eclipse is automatically copying the classes from the lib folder of Axis2 to the lib folder of the new project. 在Eclipse上开发Axis2 Web服务时,我注意到Eclipse会自动将类从Axis2的lib文件夹复制到新项目的lib文件夹。 However, not all classes from the lib folder of Axis2 are being copied. 但是,并非从Axis2的lib文件夹中复制所有类。 Interestingly, the web service runs without any problem when deployed to Tomcat via Eclipse even if some the jars from Axis2 were not copied. 有趣的是,即使未复制Axis2中的一些jar,通过Eclipse将Web服务运行到Tomcat时也不会出现任何问题。 Also, when I viewed the temp file of Tomcat, Tomcat seems to generate the jars for the listed modules on modules.list of the web service. 另外,当我查看Tomcat的临时文件时,Tomcat似乎会为Web服务的modules.list上列出的模块生成jar。

Can someone enlighten me regarding what is happening on this? 有人可以启发我有关发生的事情吗? Why Eclipse doesn't copy all the jars from Axis2? 为什么Eclipse不复制Axis2中的所有jar? Why can the web service run on Tomcat even without the other jars from Axis2? 即使没有Axis2的其他jar,为什么Web服务也可以在Tomcat上运行? What are those temp files for? 这些临时文件有什么用? When and why is it being generated? 什么时候以及为什么生成它?

I tried to run the same project on WebSphere and I am encountering a ClassDefNotFound exception because of the missing jars. 我尝试在WebSphere上运行相同的项目,由于缺少jar,我遇到了ClassDefNotFound异常。 My problem was solved when I copied all the Axis2 jars that was not copied by Eclipse to my project. 当我将所有未由Eclipse复制的Axis2 jar复制到我的项目时,我的问题得到解决。 But I'm not comfortable with my solution because Tomcat can run my project even without those jars. 但是我对我的解决方案不满意,因为即使没有这些jar,Tomcat也可以运行我的项目。 Is my solution really the right solution? 我的解决方案真的是正确的解决方案吗? Or am I missing a configuration setting? 还是我缺少配置设置?

This is just for clarification: 这只是为了澄清:

My web service is already running in Axis2. 我的Web服务已经在Axis2中运行。 My class loading policy is set to PARENT_LAST. 我的课程加载政策设置为PARENT_LAST。 I know that since WebSphere has its own Axis2 configuration, the class loading policy must be set to PARENT_LAST so that WebSphere will use the Axis2 from the project itself. 我知道,由于WebSphere具有自己的Axis2配置,因此必须将类加载策略设置为PARENT_LAST,以便WebSphere可以使用项目本身中的Axis2。 Aside from setting the class loading policy, I did something to make my web service run on WebSphere. 除了设置类加载策略之外,我还做了一些使我的Web服务在WebSphere上运行的事情。 I describe what I did above. 我描述了我在上面所做的事情。 My question is why such method must be taken? 我的问题是为什么必须采用这种方法?

WebSphere has it's own axis2 configuration as part of its Java EE server spec for JAX-WS. WebSphere具有自己的axis2配置,作为其JAX-WS的Java EE服务器规范的一部分。 Change your class loading policy to PARENT_LAST and check if that solves your problem. 将您的课程加载策略更改为PARENT_LAST,然后检查是否可以解决您的问题。

Edit: As the original post already states: WebSphere is a Java EE server depending on version it supports its the standard Java JAX-WS web services. 编辑:正如原始帖子所述:WebSphere是一台Java EE服务器,具体取决于其支持其标准Java JAX-WS Web服务的版本。 Actually web services became part of the standard jdk. 实际上,Web服务已成为标准JDK的一部分。

If you use JAX-WS like mentioned in Introduction to JAX-WS or building web services then you don't have to add any 3rd party library for getting your web services running. 如果使用JAX-WS 简介中提到的JAX-WS构建Web服务,则无需添加任何第3方库即可运行Web服务。 As soon as you use the non JDK implementation like axis2 you have to package it with your application. 一旦使用像axis2这样的非JDK实现,就必须将其与应用程序打包在一起。

IBM didn't just pack the axis2 into their WAS/JDK, they modified it. IBM不仅将axis2打包到他们的WAS / JDK中,他们对其进行了修改。 I'm not sure what Tomcat delivers, however as long as you use JAX-WS it shouldn't matter. 我不确定Tomcat提供了什么,但是只要您使用JAX-WS都没有关系。 With JAX-WS you don't have any direct import of the org.apache.axis packages. 使用JAX-WS,您无需直接导入org.apache.axis软件包。 If you use these imports you have to supply the libraries and make sure that yours are loaded. 如果使用这些导入,则必须提供库并确保已加载库。

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

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