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="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask"
                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

BUILD FAILED
/u01/opt/apps/share/lib/moSoap/moSoap-2.0.3X.xml:111: taskdef A class
needed by class org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask cannot be
found: org/apache/axis/utils/DefaultAuthenticator
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:501)
       at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:214)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
       at org.apache.tools.ant.Task.perform(Task.java:401)
       at org.apache.tools.ant.Target.execute(Target.java:338)
       at org.apache.tools.ant.Target.performTasks(Target.java:365)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
       at org.apache.tools.ant.Main.runBuild(Main.java:669)
       at org.apache.tools.ant.Main.startAnt(Main.java:220)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
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 org.apache.axis.tools.ant. 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" />
</condition>
<property name="axis.home" value="${axis-1.2.home}"/>
       <path id="axis.classpath">
            <fileset dir="${axis.home}/lib">
                <include name="**/*.jar" />
            </fileset>
      </path>
...etc.


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.

-steve





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to