0
votes

I'm trying to deploy axis2 webservices in weblogic server using maven. The project has maven modules and one of that is a war that i have defined the axis servlet in. The wsdl was there, so i used wsdl2code plugin to generate the xmlbean and schema and put that in a jar module. Structure is as below.

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

I built and deployed the ear to weblogic domain. The war was deployed successfully as part of ear and services were deployed. I am able to access wsdl files. When I tried to call the service, i got the below ClassNotFoundException for a schema file.

Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.s2104B1E6E09A2A85656B3E630BA151C1.TypeSystemHolder

I saw that the random string in that path differed fo me. So I tried to call again and got below NoClassDefFoundError, which persists even after I tried with different approaches.

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)

I searched for this and found something that told to configure app server for axis2 based on http://axis.apache.org/axis2/java/core/docs/app_server.html . When I tried it I got below error.

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

After discarding that configuration, I did some other possible deployments by having the webservice skeleton and xmlbean files in an aar and put the aar inside WEB-INF/services. I also tried putting Class-Path entry in MANIFEST.MF in ear / war for the jar files, to no avail. Still I got the same NoClassDefFoundError. Can you please give me suggestions on fixing that?

1
The first ClassNotFoundException is related to how xml bean classes are auto-generated. A full clean build usually will get you past that. Other than that it's hard to tell what you're asking because you've listed so many errors.Display Name is missing
Sorry for that listing. I just wanted to mention what I encountered. The issue is the NoClassDefFoundError. I'll edit to emphasize that.Ajaay Shereen

1 Answers

0
votes

Fixed it now. This was due to my lack of experience with Axis. Issue was that, I had the generated schema and xmlbean files moved to src folder and then just tried to use normal jar function and dependency to deploy.

Now, I removed them from src folder and use wsdl2code and axis2-aar plugins to generate the xmlbean and schema files dynamically and then package them in aar. Then I deployed the aar to webapp and it worked fine. I have listed the plugin configuration inside <build> below.

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