Hi Richard,

the problem is that your classpath for the jasper path is not correct.
So this Null Pointer exception actually means that some class was not found.
Note that you need all the tomcat libraries in your jaser classpath, as well
as your libs as well.
I post you my script, which is working Ok (on Tomcat 5.5.7).

Cheers

Bernhard


<taskdef classname="org.apache.jasper.JspC" name="jasper2" > 
        <classpath id="jspc.classpath"> 
                <pathelement location="${java.home}/../lib/tools.jar"/> 
                <fileset dir="${tomcat.home}/bin"> 
                <include name="*.jar"/> 
              </fileset> 
                <fileset dir="${tomcat.home}/server/lib"> 
                        <include name="*.jar"/> 
                </fileset> 
                <fileset dir="${tomcat.home}/common/lib"> 
                        <include name="*.jar"/> 
              </fileset>
            <fileset dir="${webapproot}${webappname}/WEB-INF/lib"> 
                <include name="*.jar"/>
            </fileset>
        </classpath>
</taskdef> 

-----Ursprüngliche Nachricht-----
Von: Richard Mixon (qwest) [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 15. August 2005 23:58
An: tomcat-user@jakarta.apache.org
Betreff: JspC compile exception in tomcat-deployer 5.5.10


Hello,

I am using the jakarta-tomcat-5.5.10-deployer to deploy my customized war
file to tomcat. When I have it do the "compile" target so it pre-compiles
the JSP's I get the exception below (its sort of long). I've got the source
and can see that it is happening as it processes the JSPs. But it gives no
clue as to which JSP is causing the problem.

Is there a way to turn on a trace that would list each file as it is
processed? I've also looked in the output directory - but there are not
class files at all. And the generated_web.xml is completely empty at this
point.

Here is how I've got the jasper2 task defined in my build.xml:
    <jasper2 validateXml="false" 
             uriroot="${webapp.path}" 
             webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
             addWebXmlMappings="true"
             outputDir="${webapp.path}/WEB-INF/classes" /> 

Notice that I turned validateXml to false - otherwise I get the following
message:
    [jasper2] org.xml.sax.SAXParseException: Document is invalid: no grammar
found.
I have compared and compared my web.xml to the spec and it seems to be OK.
It complains about position 9 in the 3rd line. Line 3 follows, position 9 is
the start of the "xmlns=" attribute:
<web-app  xmlns="http://java.sun.com/xml/ns/j2ee";
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
                version="2.4">
... which appears to be fine.

Any ideas or help is appreciated. I have tried this a few months back in
5.5.7 but got the same results (worked fine in 5.0.19). I imagine its a
problem either in one of my JSPs or in the web.xml - but cannot figure it
out.

Thanks in advance for any ideas.

 - Richard


Exception from running "ant compile":

Loaded from C:\jakarta-tomcat-5.5.10-deployer\lib\jasper-compiler.jar
org/apache/jasper/compiler/AntCompiler.class
Class org.apache.jasper.compiler.AntCompiler loaded from ant loader
(parentFirst)
Class org.apache.tools.ant.BuildListener loaded from parent loader
(parentFirst)
Couldn't load Resource commons-logging.properties
Couldn't load Resource
META-INF/services/org.apache.commons.logging.LogFactory
Finding class org.apache.log4j.Logger
Finding class org.apache.log4j.Category
Finding class org.apache.log4j.spi.AppenderAttachable
Finding class org.apache.commons.logging.impl.Log4JLogger
Loaded from C:\jakarta-tomcat-5.5.10-deployer\lib\commons-logging.jar
org/apache/commons/logging/impl/Log4JLogger.class
Class org.apache.commons.logging.impl.Log4JLogger loaded from ant loader
(parentFirst)
Finding class org.apache.log4j.Category
Finding class org.apache.log4j.Category
  [jasper2] java.lang.NullPointerException
  [jasper2]     at
org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext
.java:220)
  [jasper2]     at org.apache.jasper.JspC.processFile(JspC.java:913)
  [jasper2]     at org.apache.jasper.JspC.execute(JspC.java:1061)
  [jasper2]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
  [jasper2]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
  [jasper2]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
  [jasper2]     at java.lang.reflect.Method.invoke(Method.java:585)
  [jasper2]     at
org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:123)
  [jasper2]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
  [jasper2]     at org.apache.tools.ant.Task.perform(Task.java:364)
  [jasper2]     at org.apache.tools.ant.Target.execute(Target.java:341)
  [jasper2]     at org.apache.tools.ant.Target.performTasks(Target.java:369)
  [jasper2]     at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
  [jasper2]     at
org.apache.tools.ant.Project.executeTarget(Project.java:1185)
  [jasper2]     at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.j
ava:40)
  [jasper2]     at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
  [jasper2]     at org.apache.tools.ant.Main.runBuild(Main.java:668)
  [jasper2]     at org.apache.tools.ant.Main.startAnt(Main.java:187)
  [jasper2]     at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
  [jasper2]     at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
  [jasper2] Error in class org.apache.jasper.JspC

BUILD FAILED
C:\jakarta-tomcat-5.5.10-deployer\build.xml:49:
org.apache.jasper.JasperException
        at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:131)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.j
ava:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: org.apache.jasper.JasperException
        at org.apache.jasper.JspC.processFile(JspC.java:953)
        at org.apache.jasper.JspC.execute(JspC.java:1061)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:123)
        ... 12 more
--- Nested Exception ---
org.apache.jasper.JasperException
        at org.apache.jasper.JspC.processFile(JspC.java:953)
        at org.apache.jasper.JspC.execute(JspC.java:1061)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:123)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.j
ava:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

Total time: 3 seconds
C:\jakarta-tomcat-5.5.10-deployer>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to