axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Le Foulgoc Bertrand <lefoulg...@yahoo.fr>
Subject [Axis2][Eclipse3.1 code generator plugin] NoClassDefFoundError
Date Tue, 10 Apr 2007 14:05:03 GMT
Hi,

 After looking everywhere on the internet for a solution, I come for your help... This problem
seems really classical when considering its symptoms : 
Using          
Apache Tomcat/4.1.34-LE-jdk14axis2-1.1.1hibernate3First run : 

org.apache.axis2.AxisFault: java.lang.ExceptionInInitializerError
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:271)
    at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
    at com.company.service.pnf.ws.impl.PnfWebServiceServiceStub.getCommercant(PnfWebServiceServiceStub.java:141)
    at
 Client.main(Client.java:33)

second :

org.apache.axis2.AxisFault: java.lang.NoClassDefFoundError
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:271)
    at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
    at com.company.service.pnf.ws.impl.PnfWebServiceServiceStub.getCommercant(PnfWebServiceServiceStub.java:141)
    at Client.main(Client.java:33)

I used the code generator plugin for eclipse 3.1 to generate both server and client, and each
has the famous TypeSystemHolder.class and all resource folder in the jar and aar. (client
and server respectively), correct generated version (at least same on server and client)

After generating and regenerating a thousand times the jar and aar, revising the wsdl....and
before switching to Xfire, has anyone bumped into this problem?

Here is
 my WSDL:
-------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

                  xmlns:impl="http://com.company.service.pnf.ws.impl" 
                  xmlns:intf="http://com.company.service.pnf.ws.impl" 
                  xmlns:tns1="http://com.company.service.pnf.ws.obj" 
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                  targetNamespace="http://com.company.service.pnf.ws.impl">
   
 <wsdl:types>
        
            http://com.company.service.pnf.ws.obj"/>
            <element name="getCommercant">
                <complexType>
                        <element name="demandeCommercant"
 type="tns1:getCommercantDemande"/>
                </complexType>
            </element>
            <element name="getCommercantResponse">
                <complexType>
                    <sequence>
                        <element maxOccurs="unbounded" name="getCommercantReturn" type="tns1:getCommercantReponse"/>
                    </sequence>
                </complexType>
   
         </element>
        </schema>
        
            <complexType name="getCommercantDemande">
                    <element name="codeBanque" nillable="true" type="xsd:string"/>
            </complexType>
            <complexType name="getCommercantReponse">
       
         <sequence>
                    <element name="Id" nillable="true" type="xsd:long"/>
                    <element name="CBankCode" nillable="true" type="xsd:long"/>
                    <element name="CCounterCode" nillable="true" type="xsd:long"/>
                    <element name="CAccountCode" nillable="true" type="xsd:string"/>
                    <element name="CRibKey" nillable="true" type="xsd:long"/>
                    <element
 name="CIban" nillable="true" type="xsd:string"/>
                    <element name="CPaymentType" nillable="true" type="xsd:string"/>
                    <element name="CTraderCaution" nillable="true" type="xsd:long"/>
                    <element name="CTraderName" nillable="true" type="xsd:string"/>
                    <element name="CCbCardAccepted" nillable="true" type="xsd:long"/>
                    <element name="CDeletePaymentPossible" nillable="true" type="xsd:long"/>
               
     <element name="CFccControl" nillable="true" type="xsd:long"/>
                    <element name="CFicpControl" nillable="true" type="xsd:long"/>
                    <element name="CPrivateCardAccepted" nillable="true" type="xsd:long"/>
                    <element name="CServerAControl" nillable="true" type="xsd:long"/>
                    <element name="CServerBControl" nillable="true" type="xsd:long"/>
                    <element name="CGmtDiff" nillable="true" type="xsd:string"/>
       
             <element name="CWinterHours" nillable="true" type="xsd:long"/>
                    <element name="CFirstPayment" nillable="true" type="xsd:string"/>
                    <element name="CListKey" nillable="true" type="xsd:string"/>
                    <element name="CProductListVersion" nillable="true" type="xsd:string"/>
                    <element name="CSiret" nillable="true" type="xsd:long"/>
                    <element name="CCountryCode" nillable="true"
 type="xsd:string"/>
                    <element name="COpenDate" nillable="true" type="xsd:string"/>
                    <element name="CCloseDate" nillable="true" type="xsd:string"/>
                </sequence>
            </complexType>
        </schema>
    </wsdl:types>
    <wsdl:message name="getCommercantResponse">
        <wsdl:part name="parameters" element="impl:getCommercantResponse"/>
    </wsdl:message>
    <wsdl:message name="getCommercantRequest">
       
 <wsdl:part name="parameters" element="impl:getCommercant"/>
    </wsdl:message>
    <wsdl:portType name="PnfWebService">
        <wsdl:operation name="getCommercant">
            <wsdl:input name="getCommercantRequest" message="impl:getCommercantRequest"/>
            <wsdl:output name="getCommercantResponse" message="impl:getCommercantResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="PnfWebServiceSoapBinding" type="impl:PnfWebService">
        http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="getCommercant">
            <wsdlsoap:operation/>
            <wsdl:input>
                <wsdlsoap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <wsdlsoap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service
 name="PnfWebServiceService">
        <wsdl:port name="PnfWebService" binding="impl:PnfWebServiceSoapBinding">
            http://localhost:8080/axis2/services/PnfWebServiceService"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
--------------------------------------------------------------------------------------------------------------------------------------------------
ANT BUILD :

<project basedir="." default="jar.all">
    <!--Auto generated ant build file-->
    <property environment="env" />
    <property name="axis2.home" value="D:\JAVA\WebServices\AXIS\axis2-1.1.1" />
    <property name="project.base.dir" value="." />
    <property name="maven.class.path" value="" />
    <property name="name" value="PnfWebServiceService" />
    <property name="src" value="${project.base.dir}/src" />
    <property name="test" value="${project.base.dir}/test" />
    <property name="build" value="${project.base.dir}/build" />
    <property name="classes" value="${build}/classes" />
    <property name="lib" value="${build}/lib" />
    <property name="resources" value="${project.base.dir}/resources" />
    <property name="xbeans.packaged.jar.name" value="XBeans-packaged.jar" />   
    <property name="jars.ok" value="" />
    <path id="axis2.class.path">
        <pathelement path="${project.base.dir}/lib" />
        <pathelement path="${maven.class.path}" />
        <fileset dir="${axis2.home}">
            <include name="lib/*.jar" />
        </fileset>
    </path>
    <target name="init">
        <delete dir="${build}"/>
        <mkdir dir="${build}" />
        <mkdir dir="${classes}" />
        <mkdir dir="${lib}" />
        <mkdir dir="${test}" />
    </target>
    <target name="jar.xbeans">
        <jar basedir="${resources}" destfile="${lib}/${xbeans.packaged.jar.name}" excludes="**/services.xml,
**/*.xsd" />
    </target>
    <target name="pre.compile.test" depends="init, jar.xbeans">
        <!--Test the classpath for the availability of necesary classes-->
        <available classname="org.apache.xmlbeans.XmlObject" property="xbeans.available"
classpathref="axis2.class.path" />
        <available classname="javax.xml.stream.XMLStreamReader" property="stax.available"
classpathref="axis2.class.path" />
        <available classname="org.apache.axis2.engine.AxisEngine" property="axis2.available"
classpathref="axis2.class.path" />
        <condition property="jars.ok">
            <and>
                <isset property="xbeans.available" />
                <isset property="stax.available" />
                <isset property="axis2.available" />
            </and>
        </condition>
        <!--Print out the availabilities-->
        <echo message="XmlBeans Availability = ${xbeans.available}" />
        <echo message="Stax Availability= ${stax.available}" />
        <echo message="Axis2 Availability= ${axis2.available}" />
    </target>
    <target name="compile.src" depends="pre.compile.test" if="jars.ok">
        <javac fork="true" memoryInitialSize="256m" memoryMaximumSize="256m" debug="on"
destdir="${classes}" srcdir="${src}">
            <classpath location="${lib}/${xbeans.packaged.jar.name}" >
                  <fileset dir="${project.base.dir}/lib/hibernate">
                    <include name="*.jar"/>
                  </fileset>
            </classpath>    
            <classpath refid="axis2.class.path" />
        </javac>
    </target>
    <target name="compile.test" depends="compile.src" if="jars.ok">
        <javac fork="true" memoryInitialSize="256m" memoryMaximumSize="256m" debug="on"
destdir="${classes}">
            <src path="${test}" />
            <classpath location="${lib}/${xbeans.packaged.jar.name}" />
            <classpath refid="axis2.class.path" />
        </javac>
    </target>
    <target name="echo.classpath.problem" depends="pre.compile.test" unless="jars.ok">
        <echo message="The class path is not set right!                               
Please make sure the following classes are in the classpath                              
 1. XmlBeans                                2. Stax                                3. Axis2
                " />
    </target>
    
    <target name="jar.all" depends="jar.server, jar.client" />
    
    <target name="jar.server" depends="compile.src,echo.classpath.problem" if="jars.ok">
        <copy toDir="${classes}/META-INF" failonerror="false">
            <fileset dir="${resources}">
                <include name="*.xml" />
                <include name="*.wsdl" />
                <include name="*.xsd" />
                <include name="**/schemaorg_apache_xmlbean/**" />
            </fileset>
        </copy>
        <copy file="${lib}/${xbeans.packaged.jar.name}" toDir="${classes}/lib" />
        <!-- on copie aussi les libs d'hibernate-->            
        <copy toDir="${classes}/lib" failonerror="true">
              <fileset dir="${project.base.dir}/lib/hibernate">
                <include name="*.jar"/>
              </fileset>
        </copy>
        <jar destfile="${lib}/${name}.aar">
            <fileset excludes="**/Test.class" dir="${classes}" />
        </jar>
    </target>
    
    <target name="jar.client" if="jars.ok" depends="compile.test">
        <jar destfile="${lib}/${name}-client.jar">
            <fileset dir="${classes}">
                <exclude name="**/META-INF/*.*" />
                <exclude name="**/lib/*.*" />
                <exclude name="**/*MessageReceiver.class" />
                <exclude name="**/*Skeleton.class" />
            </fileset>
            <fileset dir="${resources}">
                <exclude name="**/*.wsdl" />
                <exclude name="**/*.xsd" />
                <exclude name="**/*.xml" />
            </fileset>
        </jar>
    </target>
    
    <target depends="jar.server" name="make.repo" if="jars.ok">
        <mkdir dir="${build}/repo/" />
        <mkdir dir="${build}/repo/services" />
        <copy file="${build}/lib/${name}.aar" toDir="${build}/repo/services/" />
    </target>
    <target depends="make.repo" name="start.server" if="jars.ok">
        <java classname="org.apache.axis2.transport.http.SimpleHTTPServer" fork="true">
            <arg value="${build}/repo" />
            <classpath refid="axis2.class.path" />
        </java>
    </target>
    
    <target if="jars.ok" name="run.test" depends="jar.client">
        <path id="test.class.path">
            <pathelement location="${lib}/${name}-client.jar" />
            <path refid="axis2.class.path" />
        </path>
        <mkdir dir="${build}/test-reports/" />
        <junit printsummary="yes" haltonfailure="yes">
            <classpath refid="test.class.path" />
            <formatter type="plain" />
            <batchtest fork="yes" toDir="${build}/test-reports/">
                <fileset dir="${test}">
                    <include name="**/*Test*.java" />
                </fileset>
            </batchtest>
        </junit>
    </target>
</project>
------------------------------------------------------------------------------------------------------------------------------------------------

Thanks for your help!

Bertrand Le Foulgoc







      
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses

http://fr.answers.yahoo.com
Mime
View raw message