You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Adam Jack <aj...@openbiz.biz> on 2002/06/27 22:45:38 UTC

jspc NullPointerException

I am trying the JspC with ANT 1.5 beta 3. Some feedback, then the latest
problem.

1) I downloaded Tomcat 4.0.4 'cos that seemed best version '4' given the
comment in the jspc page:

	By default the task uses the Jasper JSP compiler. This means the task needs
jasper.jar and 	jasper-runtime.jar, which come with builds of Tomcat
4/Catalina from the Jakarta Tomcat project
<http://jakarta.apache.org/tomcat/>

1.1) Nothing in the "Library Dependencies" seems to mention Tomcat, let
along versions.
1.2) I could find a jasper-runtime.jar but not jasper.jar. I eventually
added jasper-compiler.jar.

2) I was hoping for some consistency w/ <javac> so I copied that to start. I
failed to give an internal <include> and the task crashed with NullPointer
exception in the file scanning area.

3) I shouldn't waste folks time on the fast I tried <JspC not <jspc and it
didn't work, 'cos I guess most Ant folks know better than use the task
"title" as the name, just not me...

4) Things started to work, sorta.
     	 <jspc
                              srcdir="${src}"
                              destdir="${build}/${openbiz.part}"
                              package="com.openbiz.jsp"
                              verbose="9"
                              classpathref="project.class.path"
                      >
                      <include name="**/*.jsp" />

              </jspc>

and got.

     [java] java.lang.NullPointerException
     [java]     at
org.apache.jasper.compiler.TldLocationsCache.processWebDotXml
(TldLocationsCache.java:169)
     [java]     at
org.apache.jasper.compiler.TldLocationsCache.<init>(TldLocati
onsCache.java:145)
     [java]     at org.apache.jasper.JspC.parseFiles(JspC.java:712)
     [java]     at org.apache.jasper.JspC.main(JspC.java:742)
     [java] Exception in thread "main"

BUILD FAILED
E:\data\OpenBiz\wwwroot\build.xml:237: Java returned: 1
        at org.apache.tools.ant.taskdefs.Java.execute(Java.java:110)
        at
org.apache.tools.ant.taskdefs.optional.jsp.compilers.JasperC.execute(
JasperC.java:126)
        at
org.apache.tools.ant.taskdefs.optional.jsp.JspC.doCompilation(JspC.ja
va:458)
        at
org.apache.tools.ant.taskdefs.optional.jsp.JspC.execute(JspC.java:422
)
        at org.apache.tools.ant.Task.perform(Task.java:317)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:334)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
        at org.apache.tools.ant.Main.runBuild(Main.java:606)
        at org.apache.tools.ant.Main.start(Main.java:195)
        at org.apache.tools.ant.Main.main(Main.java:234)


Could this be 'cos my pages use taglibs? [I am not sure which one it is
trying, so I can't hack it out.]

I tried adding a uriroot, but same result.

Thanks in advance for any help.

regards

Adam
--
Open Business Interchange: <http://www.openbiz.biz>
The Revolutionary B2Bi Web Service ...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: jspc NullPointerException

Posted by Adam Jack <aj...@openbiz.biz>.
> <jspc
>                                 srcdir="${src}"
>                                 destdir="${build}/${openbiz.part}"
>                                 package="com.openbiz.jsp"
>                                 verbose="9"
>                                 uriroot="${src}"
>                                 classpathref="project.class.path"
>                         >
>                         <include name="**/*.jsp" />
> </jspc>
>
> The WEB-INF directory is below here.

STEVE>That should work. i say should, because it clearly doesnt.

STEVE>One thing I will have to look at is classpath handling. You do not
need TLD
STEVE>implementations on the classpath, just the .tld files in /webinf or
whatever
STEVE>off uriroot.

For this test I am using some JSPs with no TagLibs, and only one
jsp:include. Heck, I even just took that out, and got the same result. I
removed WEB-INF and same result. I removed all JSP .. it worked :-) -- but
did nothing. I emptied my JSP -- empty file, it crashed same as before.

Off into wild guessing, but could it be my environment? My various versions
of classes (I have a bucket-o-load of Jakata software, thanks all, so
perhaps version mismatches?) I am wondering perhaps XML -- since I have
crimson and xerces and all. I've tried to limit my classpath to the bare
essentials, namely:

..... oops, ant -debug is telling me it is removing things from the
classpath 'cos they do not exist. [Gosh, I wish this useful error, ok --
debatably warning, came out other than jsut in debug]
It seems ANT 5 beta 3 is using xerces not crimson, I need to add that in
there. I also see my compile-time classpath is getting put before the system
env classpath (my choice) before jspc is launched, I need to change that...

... and it is working. Darn, not quite...

Now I get (per file, which is better I guess):

     [echo] SRC : .
     [echo] DEST : F:/java/build/webadmin
     [echo] URIROOT : .
     [jspc] Compiling 41 source filesF:\java\build\webadmin\com\openbiz\jsp
     [java] 2002-06-28 06:36:12 - ERROR-the file '\active.jsp' generated the
fol
lowing general exception: java.lang.NullPointerException
     [java] java.lang.NullPointerException
     [java]     at java.io.FileOutputStream.open(Native Method)
     [java]     at
java.io.FileOutputStream.<init>(FileOutputStream.java:102)
     [java]     at java.io.FileOutputStream.<init>(FileOutputStream.java:62)
     [java]     at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:153
)
     [java]     at org.apache.jasper.JspC.parseFile(JspC.java:427)
     [java]     at org.apache.jasper.JspC.parseFiles(JspC.java:747)
     [java]     at org.apache.jasper.JspC.main(JspC.java:762)

The directory exists, and I do see a created directory:

	 f:/java/build/webadmin/com/openbiz/jsp

any thoughts? Clearly it seems like I have a better (hopefully right)
classpath for running Jasper, but now it seems the outputfile is somehow
making it sick. I've move it onto the same disk, I've moved it to the same
directory as source.

Just in case it is environment realted again:

CLASSPATH=F:\apps\apache\jakarta-tomcat-4.1.3\common\lib\jasper-compiler.jar
;F:\apps\apache\jakarta-tomcat-4.1.3\common\lib\jasper-runtime.jar;F:\Ant\li
b\ant.jar;F:\Ant\lib\optional.jar;F:\Ant\lib\xml-apis.jar;F:\Ant\lib\xercesI
mpl.jar;E:\apps\other\NetComponents-1.3.8a;E:\apps\junit3.7junit.jar;E:\apps
\apache\bcel-5.0\bcel.jar;E:\apps\sforge\checkstyle-2.2\checkstyle-all-2.2.j
ar

E:\data\OpenBiz\webadmin>java -version
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

and from ant -debug:

     [java] Executing 'C:\apps\jdk1.3.1\jre\bin\java.exe' with arguments:
     [java] '-classpath'
     [java]
'C:\apps\jdk1.3.1\lib\tools.jar;F:\Ant\lib\xml-apis.jar;F:\Ant\lib\x
ercesImpl.jar;F:\Ant\lib\optional.jar;F:\Ant\lib\ant.jar;F:\apps\apache\jaka
rta-
tomcat-4.1.3\common\lib\jasper-compiler.jar;F:\apps\apache\jakarta-tomcat-4.
1.3\
common\lib\jasper-runtime.jar;E:\apps\other\NetComponents-1.3.8a;E:\apps\jun
it3.
7\junit.jar;E:\apps\apache\bcel-5.0\bcel.jar;E:\apps\sforge\checkstyle-2.2\c
heck
style-all-2.2.jar;F:\java\build\base;F:\java\build\encoding;F:\java\build\mo
del;
F:\java\build\net;F:\java\build\template;F:\java\build\api;F:\java\build\ejb
api;
F:\java\build\system;F:\java\build\common;F:\java\build\client;F:\java\build
\adm
in;F:\java\build\agent;F:\java\build\connector;F:\java\build\process;F:\java
\bui
ld\application;F:\java\build\webservice;F:\java\build\website;E:\apps\OpenBi
z\op
enbiz_ejb_client.jar;E:\apps\OpenBiz\openbiz_ejb_package.jar;E:\apps\apache\
jaka
rta-log4j-1.2\dist\lib\log4j-1.2.jar;E:\apps\IBM\MQSeries\Java\Lib;E:\apps\I
BM\M
QSeries\Java\Lib\jms.jar;E:\apps\apache\xml-axis-beta2\lib\axis.jar;E:\apps\
apac
he\xml-axis-beta2\lib\jaxrpc.jar;E:\apps\apache\xml-axis-beta2\lib\wsdl4j.ja
r;E:
\apps\ibm\uddi4j\lib\uddi4j.jar;E:\apps\apache\xalan-j_2_2_D14\bin\xalan.jar
;E:\
apps\apache\xalan-j_2_2_D14\bin\xml-apis.jar;F:\apps\Sybase\EAServer\java\li
b\ea
sj2ee.jar;F:\apps\Sybase\EAServer\java\lib\easclient.jar;F:\apps\Sybase\EASe
rver
\java\lib\easserver.jar;F:\apps\Sybase\EAServer\html\classes'
     [java] 'org.apache.jasper.JspC'
     [java] '-d'
     [java] 'F:\java\build\webadmin'
     [java] '-p'
     [java] 'com.openbiz.jsp'
     [java] '-v9'
     [java] '-die9'
     [java] 'E:\data\OpenBiz\webadmin\index.jsp'
     [java]
     [java] The ' characters around the executable and arguments are
     [java] not part of the command.

I've manually created this invocation, without Ant, and I get the same
error. I guess I need to talk to the Jasper users list pretty soon...

regards,

Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jspc NullPointerException

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Adam Jack" <aj...@openbiz.biz>
To: "'Ant Users List'" <an...@jakarta.apache.org>
Sent: Friday, June 28, 2002 12:24
Subject: RE: jspc NullPointerException


> Steve,
>
> Steve> there is a webinf param that should point to where web-inf lives,
> though
> Steve> jasper should work it out for itself.
>
> I tried adding webinf="${src}/WEB-INF" (and I tried web-inf) and got
> "attribute not supported by jspc", so .... I (now) assume you were saying
> they are parameters of the commandline JSPC.

oh, no, I was confused; use uriroot to show where the base of your webapp
is.

> FWIIW: The command line JSPC
> seems to "compile" (convert to Java, at least) one page okay with:
>
>
E:\data\OpenBiz\webadmin>F:\apps\apache\jakarta-tomcat-4.1.3\bin\jspc.bat -v
> 9 -d out -p com.openbiz.jsp -uriroot=wwwroot
> wwwroot\config\connections\index.jsp
>
>      [echo] Ant : Apache Ant version 1.5Beta3 compiled on June 22 2002
>
> Steve>can you post your <jspc> declaration?
>
> The only change to it from the first posting I made was the addition of
the
> uriroot attribute, but that was 'cos command line JSPC taught me I needed
it
> for some includes. At time of execution those properties are ${src}=.
> ${build}=F:/java/biuld ${openbiz.part}=webadmin, and project.class.path is
> set (and reasonably large).
>
> <jspc
>                                 srcdir="${src}"
>                                 destdir="${build}/${openbiz.part}"
>                                 package="com.openbiz.jsp"
>                                 verbose="9"
>                                 uriroot="${src}"
>                                 classpathref="project.class.path"
>                         >
>                         <include name="**/*.jsp" />
> </jspc>
>
> The WEB-INF directory is below here.

That should work. i say should, because it clearly doesnt.

One thing I will have to look at is classpath handling. You do not need TLD
implementations on the classpath, just the .tld files in /webinf or whatever
off uriroot.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: jspc NullPointerException

Posted by Adam Jack <aj...@openbiz.biz>.
Steve,

Steve>	there is a webinf param that should point to where web-inf lives,
though
Steve>	jasper should work it out for itself.

I tried adding webinf="${src}/WEB-INF" (and I tried web-inf) and got
"attribute not supported by jspc", so .... I (now) assume you were saying
they are parameters of the commandline JSPC. FWIIW: The command line JSPC
seems to "compile" (convert to Java, at least) one page okay with:

E:\data\OpenBiz\webadmin>F:\apps\apache\jakarta-tomcat-4.1.3\bin\jspc.bat -v
9 -d out -p com.openbiz.jsp -uriroot=wwwroot
wwwroot\config\connections\index.jsp

     [echo] Ant : Apache Ant version 1.5Beta3 compiled on June 22 2002

Steve>can you post your <jspc> declaration?

The only change to it from the first posting I made was the addition of the
uriroot attribute, but that was 'cos command line JSPC taught me I needed it
for some includes. At time of execution those properties are ${src}=.
${build}=F:/java/biuld ${openbiz.part}=webadmin, and project.class.path is
set (and reasonably large).

	<jspc
                                srcdir="${src}"
                                destdir="${build}/${openbiz.part}"
                                package="com.openbiz.jsp"
                                verbose="9"
                                uriroot="${src}"
                                classpathref="project.class.path"
                        >
                        	<include name="**/*.jsp" />
	</jspc>

The WEB-INF directory is below here.

regards

Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jspc NullPointerException

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Adam Jack" <aj...@openbiz.biz>
To: "'Ant Users List'" <an...@jakarta.apache.org>
Sent: Friday, June 28, 2002 11:00 AM
Subject: RE: jspc NullPointerException


> Thanks Steve, I have tried with 4.1.3, with the same result.
>
> Reading the stack trace (below) I see processWebDotXml -- which I assume
> means it is trying to process a WEB-INF\web.xml, which I didn't have in
the
> first tree of JSPs I was working with, but even when I extract a WAR into
my
> directory, and I have this file, I get the same exception.
>
> I tried JSPC from the command line, with theoretically the same
parameters,
> and it works.
>
> Is there some aspect of the ANT task attemptign to deal with web.xml that
I
> need to configure?

there is a webinf param that should point to where web-inf lives, though
jasper should work it out for itself.

can you post your <jspc> declaration?


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: jspc NullPointerException

Posted by Adam Jack <aj...@openbiz.biz>.
Thanks Steve, I have tried with 4.1.3, with the same result.

Reading the stack trace (below) I see processWebDotXml -- which I assume
means it is trying to process a WEB-INF\web.xml, which I didn't have in the
first tree of JSPs I was working with, but even when I extract a WAR into my
directory, and I have this file, I get the same exception.

I tried JSPC from the command line, with theoretically the same parameters,
and it works.

Is there some aspect of the ANT task attemptign to deal with web.xml that I
need to configure?

jsp_compile:
     [jspc] Compiling 41 source filesF:\java\build\webadmin\com\openbiz\jsp
     [java] java.lang.NullPointerException
     [java]     at
org.apache.jasper.compiler.TldLocationsCache.processWebDotXml
(TldLocationsCache.java:169)
     [java]     at
org.apache.jasper.compiler.TldLocationsCache.<init>(TldLocati
onsCache.java:145)
     [java]     at org.apache.jasper.JspC.parseFiles(JspC.java:712)
     [java]     at org.apache.jasper.JspC.main(JspC.java:742)
     [java] Exception in thread "main"

BUILD FAILED
E:\data\OpenBiz\webadmin\build.xml:240: Java returned: 1

regards

Adam
-----Original Message-----
From: Steve Loughran [mailto:steve_l@iseran.com]
Sent: Thursday, June 27, 2002 9:59 PM
To: Ant Users List; ajack@openbiz.biz
Subject: Re: jspc NullPointerException



----- Original Message -----
From: "Adam Jack" <aj...@openbiz.biz>
To: "'Ant Users List'" <an...@jakarta.apache.org>
Sent: Thursday, June 27, 2002 13:45
Subject: jspc NullPointerException


> I am trying the JspC with ANT 1.5 beta 3. Some feedback, then the latest
> problem.
>
> 1) I downloaded Tomcat 4.0.4 'cos that seemed best version '4' given the
> comment in the jspc page:

I think 4.1 may be better

>
> By default the task uses the Jasper JSP compiler. This means the task
needs
> jasper.jar and jasper-runtime.jar, which come with builds of Tomcat
> 4/Catalina from the Jakarta Tomcat project
> <http://jakarta.apache.org/tomcat/>
>
> 1.1) Nothing in the "Library Dependencies" seems to mention Tomcat, let
> along versions.

> 1.2) I could find a jasper-runtime.jar but not jasper.jar. I eventually
> added jasper-compiler.jar.

ok, maybe they changed libs. file a bug report :)

> 2) I was hoping for some consistency w/ <javac> so I copied that to start.
I
> failed to give an internal <include> and the task crashed with NullPointer
> exception in the file scanning area.

file a defect then

>
> 4) Things started to work, sorta.
>      <jspc
>                               srcdir="${src}"
>                               destdir="${build}/${openbiz.part}"
>                               package="com.openbiz.jsp"
>                               verbose="9"
>                               classpathref="project.class.path"
>                       >
>                       <include name="**/*.jsp" />
>
>               </jspc>
>
> and got.
>
>      [java] java.lang.NullPointerException
>      [java]     at
> org.apache.jasper.compiler.TldLocationsCache.processWebDotXml
> (TldLocationsCache.java:169)
>      [java]     at
> org.apache.jasper.compiler.TldLocationsCache.<init>(TldLocati
> onsCache.java:145)
>      [java]     at org.apache.jasper.JspC.parseFiles(JspC.java:712)
>      [java]     at org.apache.jasper.JspC.main(JspC.java:742)
>      [java] Exception in thread "main"
>
> BUILD FAILED
> E:\data\OpenBiz\wwwroot\build.xml:237: Java returned: 1
>         at org.apache.tools.ant.taskdefs.Java.execute(Java.java:110)
>         at
> org.apache.tools.ant.taskdefs.optional.jsp.compilers.JasperC.execute(
> JasperC.java:126)
>         at
> org.apache.tools.ant.taskdefs.optional.jsp.JspC.doCompilation(JspC.ja
> va:458)
>         at
> org.apache.tools.ant.taskdefs.optional.jsp.JspC.execute(JspC.java:422
> )
>         at org.apache.tools.ant.Task.perform(Task.java:317)
>         at org.apache.tools.ant.Target.execute(Target.java:309)
>         at org.apache.tools.ant.Target.performTasks(Target.java:334)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
>         at org.apache.tools.ant.Main.runBuild(Main.java:606)
>         at org.apache.tools.ant.Main.start(Main.java:195)
>         at org.apache.tools.ant.Main.main(Main.java:234)
>
>
> Could this be 'cos my pages use taglibs? [I am not sure which one it is
> trying, so I can't hack it out.]

Taglibs have worked on jspc. Try getting a 4.1 drop instead, as that is
probably the best there is.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jspc NullPointerException

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Adam Jack" <aj...@openbiz.biz>
To: "'Ant Users List'" <an...@jakarta.apache.org>
Sent: Thursday, June 27, 2002 13:45
Subject: jspc NullPointerException


> I am trying the JspC with ANT 1.5 beta 3. Some feedback, then the latest
> problem.
>
> 1) I downloaded Tomcat 4.0.4 'cos that seemed best version '4' given the
> comment in the jspc page:

I think 4.1 may be better

>
> By default the task uses the Jasper JSP compiler. This means the task
needs
> jasper.jar and jasper-runtime.jar, which come with builds of Tomcat
> 4/Catalina from the Jakarta Tomcat project
> <http://jakarta.apache.org/tomcat/>
>
> 1.1) Nothing in the "Library Dependencies" seems to mention Tomcat, let
> along versions.

> 1.2) I could find a jasper-runtime.jar but not jasper.jar. I eventually
> added jasper-compiler.jar.

ok, maybe they changed libs. file a bug report :)

> 2) I was hoping for some consistency w/ <javac> so I copied that to start.
I
> failed to give an internal <include> and the task crashed with NullPointer
> exception in the file scanning area.

file a defect then

>
> 4) Things started to work, sorta.
>      <jspc
>                               srcdir="${src}"
>                               destdir="${build}/${openbiz.part}"
>                               package="com.openbiz.jsp"
>                               verbose="9"
>                               classpathref="project.class.path"
>                       >
>                       <include name="**/*.jsp" />
>
>               </jspc>
>
> and got.
>
>      [java] java.lang.NullPointerException
>      [java]     at
> org.apache.jasper.compiler.TldLocationsCache.processWebDotXml
> (TldLocationsCache.java:169)
>      [java]     at
> org.apache.jasper.compiler.TldLocationsCache.<init>(TldLocati
> onsCache.java:145)
>      [java]     at org.apache.jasper.JspC.parseFiles(JspC.java:712)
>      [java]     at org.apache.jasper.JspC.main(JspC.java:742)
>      [java] Exception in thread "main"
>
> BUILD FAILED
> E:\data\OpenBiz\wwwroot\build.xml:237: Java returned: 1
>         at org.apache.tools.ant.taskdefs.Java.execute(Java.java:110)
>         at
> org.apache.tools.ant.taskdefs.optional.jsp.compilers.JasperC.execute(
> JasperC.java:126)
>         at
> org.apache.tools.ant.taskdefs.optional.jsp.JspC.doCompilation(JspC.ja
> va:458)
>         at
> org.apache.tools.ant.taskdefs.optional.jsp.JspC.execute(JspC.java:422
> )
>         at org.apache.tools.ant.Task.perform(Task.java:317)
>         at org.apache.tools.ant.Target.execute(Target.java:309)
>         at org.apache.tools.ant.Target.performTasks(Target.java:334)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
>         at org.apache.tools.ant.Main.runBuild(Main.java:606)
>         at org.apache.tools.ant.Main.start(Main.java:195)
>         at org.apache.tools.ant.Main.main(Main.java:234)
>
>
> Could this be 'cos my pages use taglibs? [I am not sure which one it is
> trying, so I can't hack it out.]

Taglibs have worked on jspc. Try getting a 4.1 drop instead, as that is
probably the best there is.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>