views:

616

answers:

3

Hi I am getting the error taskdef A class needed by class org.apache.jasper.JspC cannot be found: Could not initialize class org.apache.jasper.JspC when I tried to build the build.xml file. can anyone please give me a solution. Thanks in advance

A: 

I had this problem too, but it was a long time ago and unfortunately my memory has become quite foggy on the subject.

As I recall, you need to start ANT with the -lib command line switch and have it point to some jar files that are needed by Jasper's JSP compiler. Again, I don't remember exactly which ones, but I think the JDK's tools.jar was one of them, as well as all the jars with jasper in the names, and commons-logging.jar and commons-el.jar. You'll have to do some experimenting :).

jqno
A: 

Do you have the required Jasper libraries in your classpath?

Thorbjørn Ravn Andersen
A: 

That is a relatively high level exception. If you would like to know more detail about what is missing from your classpath, you can run ant with the -verbose flag on the commandline.

It would be good to see the build.xml that you are using. Apache has put an example out here, which sounds similar to what you are using. If so, it requires that you specify some vars.

For this example Apache suggests:

The following command line can be used to run the script (replacing the tokens with the Tomcat base path and the path to the webapp which should be precompiled):

$ANT_HOME/bin/ant -Dtomcat.home=<$TOMCAT_HOME> -Dwebapp.path=<$WEBAPP_PATH>
akf