user1143343
user1143343

Reputation: 255

Cannot invoke wsdl code generator from ant script

I have this ant script to run:

 <?xml version="1.0" encoding="utf-8"?>
    <project name="WebserviceClient">
        <property file="myaxis.properties"/>
        <property name="build.dir" value="./src"/>
        <path id="axis2.classpath">
            <fileset dir="lib">
                <include name="*/.jar"/>
            </fileset>
        </path>

        <target name="GenerateGCWebServiceClient" >
            <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true"  dir="${build.dir}">
                <classpath refid="axis2.classpath"/>
                <sysproperty key="log4j.configuration" value="log4j.properties"/>
                <arg value="-uri"/>
                <arg value="http://192.168.0.251:9081/Services/MyWebService.svc?wsdl"/>
                <arg value="-d"/>
                <arg value="adb"/>
                <arg value="-ETransfer-Encoding"/>
                <arg value="false"/>
                <arg value="-S"/>
                <arg value="."/>
                <arg value="-u"/>
                <arg value="-wv"/>
                <arg value="1.1"/>
                <arg value="-p"/>
                <arg value="com.sands.service"/>
                <arg value="-ns2p"/>

            </java>
        </target>

    </project>

But it cannot find org.apache.axis2.wsdl.WSDL2Java. Here is stacktrace:

> build.xml
property
property
path
GenerateGCWebServiceClient
java
java.lang.NoClassDefFoundError: org/apache/axis2/wsdl/WSDL2Java
Caused by: java.lang.ClassNotFoundException: org.apache.axis2.wsdl.WSDL2Java
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

Upvotes: 1

Views: 943

Answers (1)

Jama A.
Jama A.

Reputation: 16099

Your script cannot find required library file, to be exact, it is axis2-codegen-x.y.z.jar . In your ant script you made a mistake, because of that it cannot find *.jar files:

change this line:

 <include name="*/.jar"/>

to :

<include name="*/*.jar"/>

then it should work.

Upvotes: 1

Related Questions