调用weblogic中与maven一起部署的Axis2 webservice时出现NoClassDefFoundError
我正在尝试使用maven在weblogic server中部署axis2 Web服务。该项目有maven模块,其中一个是war,我在其中定义了axis servlet。wsdl就在那里,所以我使用wsdl2code插件生成xmlbean和模式,并将其放在jar模块中。结构如下调用weblogic中与maven一起部署的Axis2 webservice时出现NoClassDefFoundError,maven,weblogic,axis2,Maven,Weblogic,Axis2,我正在尝试使用maven在weblogic server中部署axis2 Web服务。该项目有maven模块,其中一个是war,我在其中定义了axis servlet。wsdl就在那里,所以我使用wsdl2code插件生成xmlbean和模式,并将其放在jar模块中。结构如下 --lv-ear (ear with dependency on war) | --lv-ws | --lv-ws-ccid (jar module with skeleton and xmlbeans) |
--lv-ear (ear with dependency on war)
|
--lv-ws
|
--lv-ws-ccid (jar module with skeleton and xmlbeans)
|
--lv-ws-ecs (jar module with skeleton and xmlbeans)
|
--lv-ws-web (war module with dep on jar modules)
|
--WEB-INF
|
--conf/axis2.xml
--services/ccid/services.xml
我构建并部署了ear到weblogic域。战争作为ear的一部分成功部署,并部署了各种服务。我能够访问wsdl文件。当我试图调用该服务时,我得到了架构文件的以下ClassNotFoundException
Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.s2104B1E6E09A2A85656B3E630BA151C1.TypeSystemHolder
我看到路径中的随机字符串与我不同。因此,我再次尝试呼叫,并在NoClassDefFoundError下找到了答案,即使我尝试了不同的方法,结果仍然存在
java.lang.NoClassDefFoundError: Could not initialize class com.lv.ws.ccid.xmlbean.InputDocument
at com.lv.ws.ccid.xmlbean.InputDocument$Factory.parse(InputDocument.java:463)
at com.lv.ws.ccid.CcidMessageReceiverInOut.fromOM(CcidMessageReceiverInOut.java:332)
at com.lv.ws.ccid.CcidMessageReceiverInOut.invokeBusinessLogic(CcidMessageReceiverInOut.java:46)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:144)
我搜索了这个,发现了一些关于基于配置axis2应用服务器的信息。当我尝试它时,我得到了下面的错误
weblogic.xml.stax.XmlStreamInputFactory can not be cast to javax.xml.stream.XmlInputFactory
放弃该配置后,我进行了一些其他可能的部署,将webservice框架和xmlbean文件放在aar中,并将aar放在WEB-INF/services中。我还尝试将jar文件的类路径条目放入ear/war中的MANIFEST.MF中,但没有成功。我仍然得到了相同的NoClassDefFoundError。你能给我一些建议吗?现在就修好了。这是因为我对Axis缺乏经验。问题是,我将生成的模式和xmlbean文件移动到src文件夹,然后尝试使用普通jar函数和依赖项来部署 现在,我将它们从src文件夹中删除,并使用wsdl2code和axis2aar插件动态生成xmlbean和模式文件,然后将它们打包到aar中。然后我将aar部署到webapp,它运行良好。我在下面列出了插件配置
org.apache.axis2
axis2-wsdl2code-maven-plugin
1.5.4
赛迪环球酒店
wsdl2code
com.lv.ws.ccid
${basedir}/src/main/resources/META-INF/ccid.wsdl
xmlbeans
同步
真的
https://mdm.com/portal/ws/services/ccid=com.lv.ws.ccid.xmlbean
${basedir}/target/generated sources false
真的
真的
org.apache.axis2
axis2 aar maven插件
1.6.2
真的
准备包装
aar
赛迪
假的
${project.build.directory}/aar
第一个ClassNotFoundException
与自动生成XMLBean类的方式有关。一个完全干净的体格通常会让你克服这个问题。除此之外,很难说出你在问什么,因为你列出了太多的错误。很抱歉。我只是想提一下我遇到的情况。问题是NoClassDefFoundError。我将编辑以强调这一点。
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.5.4</version>
<executions>
<execution>
<id>ccid-ws</id>
<goals>
<goal>wsdl2code</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.lv.ws.ccid</packageName>
<wsdlFile>${basedir}/src/main/resources/META-INF/ccid.wsdl</wsdlFile>
<databindingName>xmlbeans</databindingName>
<syncMode>sync</syncMode>
<unpackClasses>true</unpackClasses>
<namespaceToPackages>https://mdm.com/portal/ws/services/ccid=com.lv.ws.ccid.xmlbean</namespaceToPackages>
<outputDirectory>${basedir}/target/generated-sources</outputDirectory> <generateServerSide>false</generateServerSide>
<generateServicesXml>true</generateServicesXml>
<skipWSDL>true</skipWSDL>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-aar-maven-plugin</artifactId>
<version>1.6.2</version>
<extensions>true</extensions>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>aar</goal>
</goals>
</execution>
</executions>
<configuration>
<aarName>ccid</aarName>
<includeDependencies>false</includeDependencies>
<outputDirectory>${project.build.directory}/aar</outputDirectory>
</configuration>
</plugin>
</plugins>