aspose file tools*
The moose likes Tomcat and the fly likes Ant script fails because of bad Context Path? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Ant script fails because of bad Context Path?" Watch "Ant script fails because of bad Context Path?" New topic
Author

Ant script fails because of bad Context Path?

Gran Roguismo
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
I'm not sure what the problem is here, so this question is a little hard to ask when I don't know what to provide.
I have a web project which gets compiled through and ant script. That script contains the code:


and my server.xml has this:


C:\Workspace\TollfreeReporting is the base directory
C:\Workspace\TollfreeReporting\work is a directory that ant creates and puts the compiled code into
C:\Workspace\TollfreeReporting\WebRoot is the webroot for the project

when I attempt to compile I get this:
BUILD FAILED: C:\Workspace\TollfreeReporting\build.xml:19: Compile failed; see the compiler error output for details.
and it takes me to the line
<javac srcdir="${src}" destdir="${webroot}/${bin}" debug="true"> in that ant script

Any ideas?


EOL
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Aren't there compiler errors displayed?

BUILD FAILED: C:\Workspace\TollfreeReporting\build.xml:19:
Compile failed; see the compiler error output for details.
and it takes me to the line...

for example like this:


[ April 22, 2005: Message edited by: Carol Enderlin ]

[ April 22, 2005: Message edited by: Carol Enderlin ]
[ April 22, 2005: Message edited by: Carol Enderlin ]
Gran Roguismo
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
a whole slew of errors, of which I am only going to post the last couple of lines for readability:



package javax.servlet.http does not exist seems to be a rather reoccuring theme in many of these. Where does this come from, what package do I need to include to get this?
Gran Roguismo
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
I have added servlet-api.jar and jsp-api.jar to the project build path (I am working in eclipse) but the result is the same.
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
You should start by looking at the very first compile error. The compiler starts telling you about errors that are only there because of the earlier errors.

Adding something to your eclipse build path doesn't help with an ant build.
Gran Roguismo
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
this was the first line in the error log:


I have taken the jar out of the build path and put them into the classpath


I then restarted the computer and tried again. same errors.
Gran Roguismo
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
problem solved, you were right, I was just putting it in the wrong classpath

I have now put it into the anti build path: (in eclipse)

Windows > Preferences > Ant > Runtime > Classpath

compiles fine now.
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Adding a directory to the classpath doesn't add the jars in that directory to the classpath.

Add the tomcat jars to the classpath in your build file

[ April 22, 2005: Message edited by: Carol Enderlin ]
 
 
subject: Ant script fails because of bad Context Path?