调用在weblogic中使用maven部署的Axis2 webservice时获得NoClassDefFoundError

时间:2013-10-29 14:31:32

标签: maven weblogic axis2

我正在尝试使用maven在weblogic服务器中部署axis2 webservices。该项目有maven模块,其中一个是我已定义轴servlet的战争.Wsdl在那里,所以我使用wsdl2code插件生成xmlbean和模式并将其放在jar模块中。结构如下。

--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

我构建并将其部署到weblogic域。战争成功部署,作为耳朵和部署服务的一部分。我能够访问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)

我搜索了这个,发现了一些根据http://axis.apache.org/axis2/java/core/docs/app_server.html为ax2配置应用服务器的内容。当我尝试它时,我得到了以下错误。

weblogic.xml.stax.XmlStreamInputFactory can not be cast to javax.xml.stream.XmlInputFactory

在丢弃该配置之后,我通过将web服务框架和xmlbean文件放在aar中并将aar放在 WEB-INF / services 中进行了一些其他可能的部署。我也尝试将jar文件中的 Class-Path 条目放入ear / war中的MANIFEST.MF中,但无济于事。我仍然得到了相同的 NoClassDefFoundError 。你能给我一些关于解决问题的建议吗?

1 个答案:

答案 0 :(得分:0)

现在修复它。这是由于我缺乏Axis的经验。问题是,我将生成的模式和xmlbean文件移动到src文件夹,然后尝试使用普通的jar函数和依赖项进行部署。

现在,我将它们从src文件夹中删除,并使用wsdl2code和axis2-aar插件动态生成xmlbean和schema文件,然后将它们打包在aar中。然后我将aar部署到webapp,它工作正常。我在< build>中列出了插件配置下面。

 <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> 
相关问题