【问题标题】:Got NoClassDefFoundError when invoking Axis2 webservice deployed with maven in weblogic在 weblogic 中调用使用 maven 部署的 Axis2 webservice 时出现 NoClassDefFoundError
【发布时间】:2013-10-29 14:31:32
【问题描述】:

我正在尝试使用 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

我构建并部署了 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)

我搜索了这个并找到了一些东西,告诉我根据 http://axis.apache.org/axis2/java/core/docs/app_server.html 为axis2配置应用服务器。当我尝试它时,我得到了以下错误。

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

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

【问题讨论】:

  • 第一个ClassNotFoundException与xml bean类如何自动生成有关。一个完整的干净构建通常会让你过去。除此之外,很难说出你在问什么,因为你列出了很多错误。
  • 抱歉该列表。我只是想提一下我遇到的情况。问题是 NoClassDefFoundError。我将进行编辑以强调这一点。

标签: maven weblogic axis2


【解决方案1】:

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

现在,我将它们从 src 文件夹中删除,并使用 wsdl2code 和 axis2-aar 插件动态生成 xmlbean 和 schema 文件,然后将它们打包到 aar 中。然后我将 aar 部署到 webapp,它运行良好。我在下面的 中列出了插件配置。

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

【讨论】:

    猜你喜欢
    • 2014-10-25
    • 1970-01-01
    • 2021-07-29
    • 1970-01-01
    • 1970-01-01
    • 2012-12-03
    • 2015-12-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多