Ramson Mwangi
Ramson Mwangi

Reputation: 135

Apache Axis2: [TaskDef] Could not load definitions from resource axis-tasks.properties. It could not be found

Am testing webservices using Axis2 1.6.x and I am using Ant to build and deploy it. I have set up my build scripts as:

build.xml:

<?xml version="1.0"?>
<project name="Hello World WebService" basedir="." default="about.author">
<property name="properties.file" location="build.properties"/>
<property file="${properties.file}"/>

<import file="build-webservice.xml" />
</project>

build-webservice.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Hello World - Sub build" basedir=".">

    <path id="classpath.servlet">
        <pathelement location="." />
        <fileset dir="${javax.servlet.home.dir}" >
            <include name="**/*.jar" />
        </fileset>
    </path>


    <path id="classpath.axis">
    <!--
        <fileset dir="${absolute.axis.lib.dir}">
            <include name="**/*.jar" />
        </fileset>
    -->
        <fileset dir="${absolute.tomcat.axis.lib.dir}">
            <include name="**/*.jar" />
        </fileset>
        <fileset dir="${javamail.home.dir}">
            <include name="**/*.jar" />
        </fileset>
        <fileset dir="${jaf.home.dir}">
            <include name="**/*.jar" />
        </fileset>
        <pathelement path="${absolute.axis.lib.dir}" />
    </path>

        <taskdef
            resource="axis-tasks.properties"
            classpathref="classpath.axis" />

    <target name="clean.webservice" description="Delete webservice build directory">
        <delete dir="${webservice.build.dir}" />
        <delete dir="${webservice.dist.dir}" />
    </target>

    <target name="make.webservice.dir" depends="clean.webservice" description="Create webservice build directory">
        <mkdir dir="${webservice.build.dir}" />
        <mkdir dir="${webservice.dist.dir}" />
    </target>

    <target name="compile.webservice" depends="make.webservice.dir" description="Compile webservice src">
        <javac destdir="${webservice.build.dir}" nowarn="${build.compiler.nowarn}" debug="${build.compiler.compile.with.debug}">
        <src path="${webservice.src.dir}" />
        <classpath>
            <path refid="classpath.servlet" />
        </classpath>
        </javac>
    </target>

    <target name="create.webservice.jar" depends="compile.webservice" description="Create webservice jar">
        <jar destfile="${webservice.jar.file}">
            <fileset dir="${webservice.build.dir}">
                <include name="**/*.class" />
            </fileset>
        </jar>
    </target>

    <target name="deploy.webservice.jar" depends="create.webservice.jar" description="Deploy webservice jar">
        <copy file="${webservice.jar.file}" todir="${absolute.tomcat.axis.lib.dir}" />
    </target>

    <target name="deploy.webservice" depends="deploy.webservice.jar" description="Deploy webservice on axis">
        <axis-admin
            url="http://localhost:8080/axis2/axis2-admin"
            xmlfile="${deploy.wsdd.file}" />
    </target>

    <target name="undeploy.webservice" description="Undeploy webservice">
        <axis-admin
            url="http://localhost:8080/axis2/axis2-admin" 
            xmlfile="${undeploy.wsdd.file}" />
    </target>
</project>

I'll skip out the build.properties due to its length. However when I use,

ant -p

I get:

Buildfile: `build.xml`
  [taskdef] Could not load definitions from resource axis-tasks.properties. It could not be found.

Main targets:

 about.author           About the author
 clean.webservice       Delete webservice build directory
 compile.webservice     Compile webservice src
 create.webservice.jar  Create webservice jar
 deploy.webservice      Deploy webservice on axis
 deploy.webservice.jar  Deploy webservice jar
 make.webservice.dir    Create webservice build directory
 undeploy.webservice    Undeploy webservice

and when deploying,

ant deploy.webservice

I get,

BUILD FAILED
/home/mwangi/NetBeansProjects/Webservices/masterbuild/build-webservice.xml:68: Problem: failed to create task or type axis-admin
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

Some years back, I got the same error while using Axis 1.4, I solved it by correcting the Axis lib dir I had defined as property. But now the lib dir is ok but I can't understand what is causing this error. How can I fix TaskDef considering my classpath is ok?

Upvotes: 1

Views: 933

Answers (1)

Andreas Veithen
Andreas Veithen

Reputation: 9154

Axis 1.6 doesn't exist. There is Axis 1.4 and Axis2 1.6.0. Your build script was designed for Axis and won't work with Axis2.

Upvotes: 2

Related Questions