Spring/Tomcat/Ant/Java development  
Author Message
courtney.machi





PostPosted: 2006-12-5 4:15:00 Top

java-programmer, Spring/Tomcat/Ant/Java development 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

 
Manish Pandit





PostPosted: 2006-12-5 6:35:00 Top

java-programmer >> Spring/Tomcat/Ant/Java development Try copying catalina-ant.jar to ANT_HOME/lib and see if it works out.

-cheers,
Manish

 
Mark Jeffcoat





PostPosted: 2006-12-5 7:00:00 Top

java-programmer >> Spring/Tomcat/Ant/Java development email***@***.com 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





PostPosted: 2006-12-5 7:00:00 Top

java-programmer >> Spring/Tomcat/Ant/Java development email***@***.com 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