Spring/Tomcat/Ant/Java development

Discussion in 'Java' started by courtney.machi@gmail.com, Dec 4, 2006.

  1. Guest

    Hi there,

    I am trying to build my first application with the Spring framework,
    Apache Tomcat and Ant. I am having trouble accessing the application.
    When I try to build it with Ant I get this error:

    /home/workspace/springapp/build.xml:78: taskdef class
    org.apache.catalina.ant.InstallTask cannot be found

    Here is my build.properties file:

    appserver.home=home/apache-tomcat-5.5.20
    appserver.name=tomcat
    deploy.path=${appserver.home}/webapps

    tomcat.manager.url=http://localhost:8080/manager
    tomcat.manager.username=<username>
    tomcat.manager.password=<password>

    And build.xml (just where the problem is occuring, since the whole file
    is rather lengthy):

    <taskdef name="install"
    classname="org.apache.catalina.ant.InstallTask">
    <classpath>
    <path
    location="${appserver.home}/server/lib/catalina-ant.jar"/>
    </classpath>
    </taskdef>
    <taskdef name="reload"
    classname="org.apache.catalina.ant.ReloadTask">
    <classpath>
    <path
    location="${appserver.home}/server/lib/catalina-ant.jar"/>
    </classpath>
    </taskdef>
    <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
    <classpath>
    <path
    location="${appserver.home}/server/lib/catalina-ant.jar"/>
    </classpath>
    </taskdef>
    <taskdef name="start"
    classname="org.apache.catalina.ant.StartTask">
    <classpath>
    <path
    location="${appserver.home}/server/lib/catalina-ant.jar"/>
    </classpath>
    </taskdef>
    <taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
    <classpath>
    <path
    location="${appserver.home}/server/lib/catalina-ant.jar"/>
    </classpath>
    </taskdef>

    Does anyone have a clue as to what I'm doing wrong??

    Many thanks,
    Courtney
     
    , Dec 4, 2006
    #1
    1. Advertising

  2. Try copying catalina-ant.jar to ANT_HOME/lib and see if it works out.

    -cheers,
    Manish
     
    Manish Pandit, Dec 4, 2006
    #2
    1. Advertising

  3. writes:

    > Hi there,
    >
    > I am trying to build my first application with the Spring framework,
    > Apache Tomcat and Ant. I am having trouble accessing the application.
    > When I try to build it with Ant I get this error:
    >
    > /home/workspace/springapp/build.xml:78: taskdef class
    > org.apache.catalina.ant.InstallTask cannot be found
    >


    You've got a classloader problem.

    Ant will set up a classpath for your project, but it can't use
    that one to load itself. Put catalina-ant.jar into your CLASSPATH
    in the environment that loads Ant, and it'll be able to find
    InstallTask.

    --
    Mark Jeffcoat
    Austin, TX
     
    Mark Jeffcoat, Dec 4, 2006
    #3
  4. writes:

    > Hi there,
    >
    > I am trying to build my first application with the Spring framework,
    > Apache Tomcat and Ant. I am having trouble accessing the application.
    > When I try to build it with Ant I get this error:
    >
    > /home/workspace/springapp/build.xml:78: taskdef class
    > org.apache.catalina.ant.InstallTask cannot be found



    Continuing from my previous post....

    You can also wrap the task declaration in a target, so that Ant
    won't try to load it until it's needed. Something like ...

    <target name="declare-tomcat-tasks">
    <taskdef name="deploy" classname="..." classpathref="..." />
    </target>

    You can that way avoid having to set up the external
    environment. Be sure that targets that use any of the
    defined tasks declare a dependency on declare-tomcat-tasks.

    (I don't do it that way because at some point I convinced myself
    that I was going to need the CLASSPATH declaration to make the
    <junit> task work anyway, so that particular bit of advice is
    somewhat less tested.)

    --
    Mark Jeffcoat
    Austin, TX
     
    Mark Jeffcoat, Dec 4, 2006
    #4
  5. Merlin Rajaselvi

    Joined:
    Aug 13, 2011
    Messages:
    1
    I came across a solution for this in another thread. Try this out, it may fix the issue.

    In build.xml file, replace the following lines with :

    <taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
    <classpath refid="catalina-ant-classpath"/>
    </taskdef>

    with

    <taskdef name="install" classname="org.apache.catalina.ant.DeployTask">
    <classpath refid="catalina-ant-classpath"/>
    </taskdef>
     
    Merlin Rajaselvi, Aug 13, 2011
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Bedford
    Replies:
    6
    Views:
    2,266
  2. Brian (withholding surname)

    Java/Spring/Tomcat

    Brian (withholding surname), Jul 3, 2006, in forum: Java
    Replies:
    2
    Views:
    8,826
    Mark Space
    Jul 5, 2006
  3. etienno
    Replies:
    0
    Views:
    616
    etienno
    Dec 13, 2006
  4. rmn190
    Replies:
    2
    Views:
    2,402
    Arne Vajhøj
    Jan 10, 2008
  5. Goldfish
    Replies:
    1
    Views:
    782
    Goldfish
    Nov 6, 2008
Loading...

Share This Page