• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Failed build : InstallTask cannot be found

 
Ranch Hand
Posts: 271
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm going through the step by step Spring MVC introduction tutorial at
http://www.springframework.org/docs/MVC-step-by-step/Spring-MVC-step-by-step-Part-1.html

and have setup my environment correctly.How ever when I try just running "ant" from the springapp directory the build fails with the message :

BUILD FAILED
C:\projects_main\springapp\build.xml:78: taskdef class org.apache.catalina.ant.I
nstallTask cannot be found



Line 78 in question is :

taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
<classpath>
<path location="${appserver.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>





The catalina-ant.jar is there in "${appserver.home}/server/lib/".
${appserver.home} is pointing to "C:\apache-tomcat-5.5.16"

Thanx
jeff mutonho
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had this problem on windows 2000. I got it working by changing the build.properties file. The key was using forward slash "/" for file paths which is not normal in windows.

SAMPLE build.properties file:

# Ant properties for building the springapp

appserver.home=c:/tomcat
deploy.path=c:/tomcat/webapps

tomcat.manager.url=http://localhost:8080/manager
tomcat.manager.username=both
tomcat.manager.password=tomcat
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i also faced the same problem when testing the example.When i checked i saw my tomcat home was not containing any server directory.All jar files were inside lib only .So from the build script i just removed server and it worked fine.
 
Saloon Keeper
Posts: 28328
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark Boicey wrote:I had this problem on windows 2000. I got it working by changing the build.properties file. The key was using forward slash "/" for file paths which is not normal in windows.



You might be interested in knowing that in almost all cases, using a forward slash in pathnames in Java is the better way to go. One of the primary reasons that that is the backslash is frequently interpreted as an escape character, and therefore will result of the formation of an actual pathname that doesn't quite match the pathname you wanted. This is especially true in java strings and properties files.

Another reason for doing this is that the forward slash is the generic path component separator for the Java File classes. If you use it, often the same code will work unchanged whether the filesystem in question is Windows, Unix, or something more esoteric.

Finally, in certain cases, Windows itself will honor forward slashes as though they were backslashes. I don't have the formal specs on that, but the primary obstacle to wider use of forward slashes in Windows pathnames is that the forward slash is used as the command-line option switch indicator (Unix uses '-'). So to avoid command-parsing issues, Windows is sort of stuck with backslash.
 
Greenhorn
Posts: 3
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey I am having this same issue (I also happen to be going through the Spring tutorial).

Tomcat is located at C:/dev/apache-tomcat-7.0.5, ant is at C:/dev/ant, and my application is c:/dev/springapp.


My build.properties file looks like this:

appserver.home=C:/dev/apache-tomcat-7.0.5

appserver.lib=${appserver.home}/lib

deploy.path=${appserver.home}/webapps

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



And the relevant part of my build.xml file is:




but when I go to c:/dev/springapp and run the ant command, I keep getting following error:

BUILD FAILED
c:\dev\springapp\build.xml:85: taskdef class org.apache.catalina.ant.InstallTask cannot be found
using the classloader AntClassLoader[C:\dev\apache-tomcat-7.0.5\lib\catalina-ant.jar]


Which is perplexing, since C:\dev\apache-tomcat-7.0.7\lib\catalina-ant.jar is the exact path to my catalina-ant jar.


Does anyone have any idea why this might be happening???
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch, Brett Chatman & Mark Boicey

Brett Chatman wrote:...Does anyone have any idea why this might be happening???


Most probably a class loader issue...
Have you tried setting the catalina-ant.jar in the CLASSPATH of the environment which loads Ant?
 
Brett Chatman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree that it probably is a classloader problem, but I have no idea what to do about it. I tried what you said, and put the catalina-ant.jar in my CLASSPATH variable ( I am running windows 7 64 bit ), but I got the same error. I also tried removing catalina-ant from tomcat's lib folder, but more of the same.

Any more suggestions/ideas would be much appreciated.

I don't know if this will be helpful or not, but my TOMCAT_HOME/lib folder looks like this:

annotations-api.jar
catalina-ant.jar
catalina-ha.jar
catalina-tribes.jar
catalina.jar
ecj-3.6.jar
el-api.jar
jasper-el.jar
jasper.jar
jsp-api.jar
servlet-api.jar
tomcat-api.jar
tomcat-coyote.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar
tomcat-util.jar

And my ANT_HOME/lib directory looks like so:

ant-antlr.jar
ant-antlr.pom
ant-apache-bcel.jar
ant-apache-bcel.pom
ant-apache-bsf.jar
ant-apache-bsf.pom
ant-apache-log4j.jar
ant-apache-log4j.pom
ant-apache-oro.jar
ant-apache-oro.pom
ant-apache-regexp.jar
ant-apache-regexp.pom
ant-apache-resolver.jar
ant-apache-resolver.pom
ant-apache-xalan2.jar
ant-apache-xalan2.pom
ant-commons-logging.jar
ant-commons-logging.pom
ant-commons-net.jar
ant-commons-net.pom
ant-jai.jar
ant-jai.pom
ant-javamail.jar
ant-javamail.pom
ant-jdepend.jar
ant-jdepend.pom
ant-jmf.jar
ant-jmf.pom
ant-jsch.jar
ant-jsch.pom
ant-junit.jar
ant-junit.pom
ant-junit4.jar
ant-junit4.pom
ant-launcher.jar
ant-launcher.pom
ant-netrexx.jar
ant-netrexx.pom
ant-parent.pom
ant-swing.jar
ant-swing.pom
ant-testutil.jar
ant-testutil.pom
ant.jar
ant.pom
libraries.properties

I don't know if there might be two instances of the InstallTask class or something?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two things I can think of.

First, run ant with the -v option - that should print out some more information about what it is doing. I think that will print out the JARs used in a classpath.

Second, it could very well be that while org.apache.catalina.ant.InstallTask is in catalina-ant.jar, that class relies on other classes that appear in other JARs in the tomcat lib directory. Try changing the include value to be **/*.jar.
 
Greenhorn
Posts: 5
  • Likes 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Class InstallTask is deprecated & replaced by DeployTask, so later version catalina-ant.jar (tomcat set up) doesn't have class InstallTask. It's just the case of replacing InstallTask by DeployTask to see it working again. For example, following entry in build.xml in spring mvc tutorial
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>

should be replaced as

<taskdef name="install" classname="org.apache.catalina.ant.DeployTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That works! Many thanks
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch, K Max
 
Brett Chatman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OMG that was it. Thank you so much! I have been completely frustrated by this for the past 2 months and had just about given up on ant/tomcat ever running on my box.

Thanks a million.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just wanted to say THANK YOU to that last VERY helpful post!! I didn't spend two months but about an hour or so looking into why I was getting that error. I tried about 4 different things - so frustrating and such a waste of time!

Thanks a ton! Changing that darn little line - <taskdef name="install" classname="org.apache.catalina.ant.DeployTask"> - did the trick for me!

I read somewhere you shouldn't mess with the classpath when dealing with ant - I believe this was on that actual ant documentation, so I was trying to avoid doing the suggestion posted earlier in the thread - and a couple yrs ago.

Well, thanks a lot!! Really appreciate it!!!


On a side note, how are we suppose to know what changed inside the jar? I mean come on, it's hard enough trying to correctly setup your environment LOL However did you find that info! Amazing! Thanks!
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch, Daisy Gutierrez

how are we suppose to know what changed inside the jar?


I'm not sure they have a separate release note as such for this other than the general Tomcat release notes (e.g: link) which doesn't say anything about the specific modifications.

One possibility: Get the source of Tomcat and look at the InstallTask.java and the Java Docs says this is deprecated and replaced by the DeployTask (I know it's bit of a work )
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Daisy Gutierrez wrote:
On a side note, how are we suppose to know what changed inside the jar? I mean come on, it's hard enough trying to correctly setup your environment LOL However did you find that info! Amazing! Thanks!



class org.apache.catalina.ant.InstallTask cannot be found
using the classloader AntClassLoader[C:\dev\apache-tomcat-7.0.5\lib\catalina-ant.jar]


I'd say this is telling you that the class org.apache.catalina.ant.InstallTask cannot be found in the jar C:\dev\apache-tomcat-7.0.5\lib\catalina-ant.jar - so just open the jar up and have a look (rename to eg C:\dev\apache-tomcat-7.0.5\lib\catalina-ant.zip and open in winzip or whatever) - if you can't see the class, chances are that you have an incompatible jar file.

So if you don't read release notes, you will at least get to know about it as soon as you try and deploy/run.
 
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You very much..Nilesh
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Nilesh Nikam, this also solved my problem.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks from me also.

It's nice when you find a forum post that deals *exactly" with what you need.
 
Greenhorn
Posts: 1
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nilesh Nikam wrote:Class InstallTask is deprecated & replaced by DeployTask, so later version catalina-ant.jar (tomcat set up) doesn't have class InstallTask. It's just the case of replacing InstallTask by DeployTask to see it working again. For example, following entry in build.xml in spring mvc tutorial
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>

should be replaced as

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



Thank you very much Nilesh. I had the same problem.
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Lighton.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vinod Maladkar,
Your post was moved to a new topic.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The fact that InstallTask is deprecated is only the first problem you will face if you are following the tutorial at http://www.springframework.org/docs/MVC-step-by-step/Spring-MVC-step-by-step-Part-1.html

I did a post listing the changes that you need to apply to follow the tutorial if you are using Tomcat 7.x and Spring 3, here is the link: http://blog.gmorales.net/2012/01/changes-on-developing-spring-framework.html

Good luck
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic