This week's book giveaway is in the Testing forum. We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line! See this thread for details.
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
Mark Boicey
Greenhorn
Joined: Apr 28, 2006
Posts: 1
posted
0
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.
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.
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.
One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
Brett Chatman
Greenhorn
Joined: Jan 15, 2011
Posts: 3
posted
1
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.
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???
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:
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.
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>
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.
Daisy Gutierrez
Greenhorn
Joined: Mar 08, 2011
Posts: 3
posted
0
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!
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 )
Pete Hawdon
Greenhorn
Joined: Jul 19, 2006
Posts: 2
posted
0
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.
Neha Daga
Ranch Hand
Joined: Oct 30, 2009
Posts: 504
posted
0
Thank You very much..Nilesh
SCJP 1.6 96%
David Brave
Greenhorn
Joined: May 20, 2010
Posts: 24
posted
0
Thank you Nilesh Nikam, this also solved my problem.
Clive Flatau
Greenhorn
Joined: Sep 05, 2005
Posts: 2
posted
0
Thanks from me also.
It's nice when you find a forum post that deals *exactly" with what you need.
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>