tags:

views:

146

answers:

6

When I gave ant myproject-war. I got the following error. can any one help plzz

BUILD FAILED
C:\Documents and Settings\personal\Desktop\project files\myproject\bu
ild.xml:167: taskdef A class needed by class org.apache.jasper.JspC cannot be fo
und: javax/servlet/ServletContext
A: 

Gotta add a JAR containing javax.servlet.ServletContext to your CLASSPATH.

duffymo
A: 

Check your manifest and classpath. They might not be including the necessary jar.

For instance: classpathref="some_classpath" could go in the javac tag, where some_classpath equals

<path id="some_classpath">
 <pathelement location="${someJar.jar}"/>
 <pathelement location="${another.jar}"/>
</path>

Also, you jar's manifest should have something like:

<manifest>
    <attribute name="Class-Path" value="../lib/another.jar ../lib/someJar.jar"/>
</manifest>
geowa4
hi this is my tag where i found jspc. could you plz help<property environment="env" /> <taskdef classname="org.apache.jasper.JspC" name="jasper2"> <classpath id="jspc.classpath"> <pathelement location="${java.home}/../lib/tools.jar" /> <fileset dir="${env.tomcat.home}/bin2"> <include name="*.jar" /> </fileset> <fileset dir="${env.tomcat.home}/server/lib"> <include name="*.jar" /> </fileset> <fileset dir="${env.tomcat.home}/common/lib"> <include name="*.jar" /> </fileset> </classpath> </taskdef>
A: 

In ant new tasks can be defined (taskdef). Some of these tasks need you to put java-libraries into the classpath of ant. That can be realized by copying the appropriate jar into the lib/ext-directory of the ant-installation.

Mnementh
A: 

You need a jar in your classpath for the target that's running JspC that contains javax.servlet.ServletContext. So, for example, if you're using Tomcat, servlet-api.jar might be the jar you're looking for. If you're doing GWT, gwt-user.jar might be the jar. Depends on your context.

Don Branson
i have servlet.api.jar in my project's lib folder
Also, you need to make sure that that jar is added to your classpath definition in your build.xml file for the target that's invoking JspC.
Don Branson
A: 

You are using Ant tasks with dependencies not supported in the core API.

From the documentation:

Ant supports a number of optional tasks. An optional task is a task which typically requires an external library to function. The optional tasks are packaged together with the core Ant tasks.

Use the manual to locate the optional tasks and add the required dependencies to the classpath.

McDowell
A: 

ant doesnt take spaces in classpath.

Praveen