ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: taskdef with classpathref not working
Date Wed, 11 Jan 2006 11:48:24 GMT
Michael Alexander wrote:
> I want to be able to define task's that use either the axis-1_1
> or the axis-1_2_1 jars depending upon the value of a property.
> The intent is to avoid having users explicitly set their CLASSPATH
> before invoking the build. I have found examples such as the following
> that appear to be exactly what I want but I have not been able to get
> this (or a large number of other variants) to work.
> I'm running java 1.4.2 with ant 1.6.0 on linux.
>    <target name="init_axis-1_2_1" unless="axis.version.1_1">
>        <echo message="Setting axis.classpath to **/*.jar in 
> ${axis.home}/lib"/>
>        <path id="axis.classpath">
>            <fileset dir="${axis.home}/lib">
>                <include name="**/*.jar" />
>            </fileset>
>        </path>
>        <property name="axis.classpath.string" refid="axis.classpath"/>
>        <echo message="axis.classpath=${axis.classpath.string}"/>
>        <taskdef name="axis-wsdl2java"
>                 classname=""
>                 classpathref="axis.classpath">
>        </taskdef>
>    </target>
> This runs great, the conditional is triggered correctly, the axis 
> classpath is
> set correctly, but I get the following error upon build.
> init_axis-1_2_1:
>     [echo] Setting axis.classpath to **/*.jar in /opt/jlib/axis-1_2_1/lib
>     [echo] 
> axis.classpath=/opt/jlib/axis-1_2_1/lib/activation.jar:/opt/jlib/axis-1_2_1/lib/axis-ant.jar:/opt/jlib/axis-1_2_1/lib/axis.jar:/opt/jlib/axis-1_2_1/lib/commons-discovery-0.2.jar:/opt/jlib/axis-1_2_1/lib/commons-httpclient-3.0-rc2.jar:/opt/jlib/axis-1_2_1/lib/commons-logging-1.0.4.jar:/opt/jlib/axis-1_2_1/lib/jaxrpc.jar:/opt/jlib/axis-1_2_1/lib/log4j-1.2.8.jar:/opt/jlib/axis-1_2_1/lib/mailapi_1_3_1.jar:/opt/jlib/axis-1_2_1/lib/saaj.jar:/opt/jlib/axis-1_2_1/lib/servlet.jar:/opt/jlib/axis-1_2_1/lib/wsdl4j-1.5.1.jar:/opt/jlib/axis-1_2_1/lib/xercesImpl.jar:/opt/jlib/axis-1_2_1/lib/xmlParserAPIs.jar

> /u01/opt/apps/share/lib/moSoap/moSoap-2.0.3X.xml:111: taskdef A class
> needed by class cannot be
> found: org/apache/axis/utils/DefaultAuthenticator
>        at 
>        at
>        at 
>        at
>        at
>        at
>        at
>        at
>        at
>        at
>        at
>        at
> Caused by: java.lang.NoClassDefFoundError: 
> org/apache/axis/utils/DefaultAuthenticator
> The class is definitely on the classpath.
> Anyone know what gives?

It looks like axis-ant.jar is being loaded, but part of axis.jar itself 
is not being picked up.

  Make sure there is no other axis-ant.jar in your classpath (do 
-diagnostics) to make sure it hasnt crept in

Other points

-there is a properties file somewhere under 
that defines all the ant tasks that axis includes
-instead of two targets to set up the path and tasks, you could have one 
target which chooses a different axis.home value depending on a switch, 
then use that

<condition property="axis.home" value="${axis-1.1.home}">
  <istrue "use.axis.1.1" />
<property name="axis.home" value="${axis-1.2.home}"/>
        <path id="axis.classpath">
             <fileset dir="${axis.home}/lib">
                 <include name="**/*.jar" />

I would also point out that Axis1.3 is newly out, and that I would 
really not use axis1.1 in a production system, due to some bugs, 
especially its quirky handling of mustUnderstand.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message