facebook

build error using build.xml

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #293338 Reply

    pinesystems
    Member

    Hi,
    I am using MyEclipse 6.0.1 and and tomcat 6.
    when I ran build.xml (see content below), I got the following error message.
    Please advise,
    Jimmy

    C:\workspace\simplepro1\build.xml:83:
    taskdef class org.apache.catalina.ant.InstallTask cannot be found

    build.xml content:

    
    <?xml version="1.0"?>
    <project name="simplepro" basedir="." default="usage">
        <property file="build.properties" />
        <property name="src.dir" value="src" />
        <property name="web.dir" value="war" />
        <property name="build.dir" value="${web.dir}/WEB-INF/classes" />
        <property name="name" value="simplepro" />
        <path id="master-classpath">
            <fileset dir="${web.dir}/WEB-INF/lib">
                <include name="*.jar" />
            </fileset>
            <!-- We need the servlet API classes:        -->
            <!--   for Tomcat 4.1 use servlet.jar        -->
            <!--   for Tomcat 5.0 use servlet-api.jar    -->
            <!--   for Other app server - check the docs -->
            <fileset dir="${appserver.home}/lib">
                <include name="servlet*.jar" />
            </fileset>
            <pathelement path="${build.dir}" />
        </path>
        <target name="usage">
            <echo message="" />
            <echo message="${name} build file" />
            <echo message="-----------------------------------" />
            <echo message="" />
            <echo message="Available targets are:" />
            <echo message="" />
            <echo message="build     --> Build the application" />
            <echo message="deploy    --> Deploy application as directory" />
            <echo message="deploywar --> Deploy application as a WAR file" />
            <echo message="clean     --> Clean output directories" />
            <echo message="undeploy  --> Un-Deploy application" />
            <echo message="install   --> Install application in Tomcat" />
            <echo message="reload    --> Reload application in Tomcat" />
            <echo message="start     --> Start Tomcat application" />
            <echo message="stop      --> Stop Tomcat application" />
            <echo message="list      --> List Tomcat applications" />
            <echo message="" />
        </target>
        <target name="build" description="Compile main source tree java files">
            <mkdir dir="${build.dir}" />
            <javac destdir="${build.dir}" debug="true" deprecation="false" optimize="false" failonerror="true">
                <src path="${src.dir}" />
                <classpath refid="master-classpath" />
            </javac>
        </target>
        <target name="deploy" depends="build" description="Deploy application">
            <copy todir="${deploy.path}/${name}" preservelastmodified="true">
                <fileset dir="${web.dir}">
                    <include name="**/*.*" />
                </fileset>
            </copy>
        </target>
        <target name="deploywar" depends="build" description="Deploy application as a WAR file">
            <war destfile="${name}.war" webxml="${web.dir}/WEB-INF/web.xml">
                <fileset dir="${web.dir}">
                    <include name="**/*.*" />
                </fileset>
            </war>
            <copy todir="${deploy.path}" preservelastmodified="true">
                <fileset dir=".">
                    <include name="*.war" />
                </fileset>
            </copy>
        </target>
        <target name="clean" description="Clean output directories">
            <delete>
                <fileset dir="${build.dir}">
                    <include name="**/*.class" />
                </fileset>
            </delete>
        </target>
        <target name="undeploy" description="Un-Deploy application">
            <delete>
                <fileset dir="${deploy.path}/${name}">
                    <include name="**/*.*" />
                </fileset>
            </delete>
        </target>
        <!-- ============================================================== -->
        <!-- Tomcat tasks - remove these if you don't have Tomcat installed -->
        <!-- ============================================================== -->
        <taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <target name="install" description="Install application in Tomcat">
            <install url="${tomcat.manager.url}" 
                             username="${tomcat.manager.username}" 
                             password="${tomcat.manager.password}" 
                             path="/${name}" 
                             war="${name}" />
        </target>
        <target name="reload" description="Reload application in Tomcat">
            <reload url="${tomcat.manager.url}" 
                      username="${tomcat.manager.username}" 
                      password="${tomcat.manager.password}" 
                      path="/${name}" />
        </target>
        <target name="start" description="Start Tomcat application">
            <start url="${tomcat.manager.url}" 
                         username="${tomcat.manager.username}" 
                         password="${tomcat.manager.password}" 
                         path="/${name}" />
        </target>
        <target name="stop" description="Stop Tomcat application">
            <stop url="${tomcat.manager.url}" 
                        username="${tomcat.manager.username}" 
                        password="${tomcat.manager.password}" 
                        path="/${name}" />
        </target>
        <target name="list" description="List Tomcat applications">
            <list url="${tomcat.manager.url}" 
                        username="${tomcat.manager.username}" 
                        password="${tomcat.manager.password}" />
        </target>
        <!-- End Tomcat tasks -->
    </project>
    
    #293376 Reply

    Loyal Water
    Member

    Looks like you build file cannot find the task class. You should check to make sure the jar the build file is looking for is present in the directory specified in the build file.

    #293423 Reply

    pinesystems
    Member

    my tomcat base folder is located at c:\tomcat6

    There are 17 jar files in the c:\tomcat6\lib folder:
    annotations-api.jar, catalina-ant.jar, …., etc.

    I suspect I did NOT set up the tomcat server within the MyEclipse environment correctly.

    Could you provide me with a detailed procedure how to set up the tomcat6 folder in the MyEclipse environment?

    Thanks,
    Jimmy

    #293432 Reply

    pinesystems
    Member

    I copied the catalina-ant.jar file from the tomcat6 lib folder to the ant lib folder.
    It is working now.

    New Question:

    How do I set the tomcat manager username and password in MyEclipse?

    I’ve already set the manager role correctly in the tomcat-users.xml file.

    Thanks,
    Jimmy

    <target name=”install” description=”Install application in Tomcat”>
    <install url=”${tomcat.manager.url}”
    username=”${tomcat.manager.username}”
    password=”${tomcat.manager.password}”
    path=”/${name}”
    war=”${name}” />
    </target>

    #293463 Reply

    Loyal Water
    Member

    The tomcat administrator has been discussed in this post. Hope that helps:-
    http://www.myeclipseide.com/PNphpBB2-printview-t-4849-start-15.html

    #293481 Reply

    pinesystems
    Member

    Perhaps I did NOT explain my problem clearly.

    The tomcat manager is set up CORRECTLY, I can access it from
    http://localhost:8080 with NO problem.

    The PROBLEM that I HAVE is listed below

    Buildfile: C:\workspace\simplepro1\build.xml
    install:

    BUILD FAILED
    C:\workspace\simplepro1\build.xml:113: java.net.MalformedURLException: no protocol: ${tomcat.manager.url}/install?path=%2Fsimplepro&war=simplepro

    CONTENT of build.xml is listed below:

    <?xml version="1.0"?>
    <project name="simplepro" basedir="." default="usage">
        <property file="build.properties" />
        <property name="src.dir" value="src" />
        <property name="web.dir" value="war" />
        <property name="build.dir" value="${web.dir}/WEB-INF/classes" />
        <property name="name" value="simplepro" />
        <path id="master-classpath">
            <fileset dir="${web.dir}/WEB-INF/lib">
                <include name="*.jar" />
            </fileset>
            <!-- We need the servlet API classes:        -->
            <!--   for Tomcat 4.1 use servlet.jar        -->
            <!--   for Tomcat 5.0 use servlet-api.jar    -->
            <!--   for Other app server - check the docs -->
            <fileset dir="${appserver.home}/lib">
                <include name="servlet*.jar" />
            </fileset>
            <pathelement path="${build.dir}" />
        </path>
        <target name="usage">
            <echo message="" />
            <echo message="${name} build file" />
            <echo message="-----------------------------------" />
            <echo message="" />
            <echo message="Available targets are:" />
            <echo message="" />
            <echo message="build     --> Build the application" />
            <echo message="deploy    --> Deploy application as directory" />
            <echo message="deploywar --> Deploy application as a WAR file" />
            <echo message="clean     --> Clean output directories" />
            <echo message="undeploy  --> Un-Deploy application" />
            <echo message="install   --> Install application in Tomcat" />
            <echo message="reload    --> Reload application in Tomcat" />
            <echo message="start     --> Start Tomcat application" />
            <echo message="stop      --> Stop Tomcat application" />
            <echo message="list      --> List Tomcat applications" />
            <echo message="" />
        </target>
        <target name="build" description="Compile main source tree java files">
            <mkdir dir="${build.dir}" />
            <javac destdir="${build.dir}" debug="true" deprecation="false" optimize="false" failonerror="true">
                <src path="${src.dir}" />
                <classpath refid="master-classpath" />
            </javac>
        </target>
        <target name="deploy" depends="build" description="Deploy application">
            <copy todir="${deploy.path}/${name}" preservelastmodified="true">
                <fileset dir="${web.dir}">
                    <include name="**/*.*" />
                </fileset>
            </copy>
        </target>
        <target name="deploywar" depends="build" description="Deploy application as a WAR file">
            <war destfile="${name}.war" webxml="${web.dir}/WEB-INF/web.xml">
                <fileset dir="${web.dir}">
                    <include name="**/*.*" />
                </fileset>
            </war>
            <copy todir="${deploy.path}" preservelastmodified="true">
                <fileset dir=".">
                    <include name="*.war" />
                </fileset>
            </copy>
        </target>
        <target name="clean" description="Clean output directories">
            <delete>
                <fileset dir="${build.dir}">
                    <include name="**/*.class" />
                </fileset>
            </delete>
        </target>
        <target name="undeploy" description="Un-Deploy application">
            <delete>
                <fileset dir="${deploy.path}/${name}">
                    <include name="**/*.*" />
                </fileset>
            </delete>
        </target>
        <!-- ============================================================== -->
        <!-- Tomcat tasks - remove these if you don't have Tomcat installed -->
        <!-- ============================================================== -->
        <taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
            <classpath>
                <path location="${appserver.home}/lib/catalina-ant.jar" />
            </classpath>
        </taskdef>
        <target name="install" description="Install application in Tomcat">
            <install url="${tomcat.manager.url}" 
                             username="${tomcat.manager.username}" 
                             password="${tomcat.manager.password}" 
                             path="/${name}" 
                             war="${name}" />
        </target>
        <target name="reload" description="Reload application in Tomcat">
            <reload url="${tomcat.manager.url}" 
                      username="${tomcat.manager.username}" 
                      password="${tomcat.manager.password}" 
                      path="/${name}" />
        </target>
        <target name="start" description="Start Tomcat application">
            <start url="${tomcat.manager.url}" 
                         username="${tomcat.manager.username}" 
                         password="${tomcat.manager.password}" 
                         path="/${name}" />
        </target>
        <target name="stop" description="Stop Tomcat application">
            <stop url="${tomcat.manager.url}" 
                        username="${tomcat.manager.username}" 
                        password="${tomcat.manager.password}" 
                        path="/${name}" />
        </target>
        <target name="list" description="List Tomcat applications">
            <list url="${tomcat.manager.url}" 
                        username="${tomcat.manager.username}" 
                        password="${tomcat.manager.password}" />
        </target>
        <!-- End Tomcat tasks -->
    </project>
    #293528 Reply

    jhm
    Member

    1. For all the taskdefs it would be easier to set an “id” attribute on the first <taskdef><classpath> and use <taskdef><classpath refid> for following taskdefs.
    2. When you add JARs to ANT_HOME/lib you change the Ant classpath for other projects too. So be careful with that.
    3. Is you property appserver.home set correctly? Ensure that ${appserver.home}/lib/catalina-ant.jar is found.
    4. Your last problem seems to be that the property tomcat.manager.url is not set. Otherwise the error message would print the calculated value.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: build error using build.xml

You must be logged in to post in the forum log in