Spring/Tomcat/Ant/Java development

C

courtney.machi

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
 
M

Manish Pandit

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

-cheers,
Manish
 
M

Mark Jeffcoat

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.
 
M

Mark Jeffcoat

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.)
 
Joined
Aug 13, 2011
Messages
1
Reaction score
0
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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top