You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kris Schneider <kr...@dotech.com> on 2002/08/10 04:10:15 UTC

Command line jspc throws NPE for page using JSTL

(Alrighty, this is actually attempt number 3 to get this note posted.
Gotta get more caffeine to the gerbils powering the email server...)

When I try to use jspc from the command line to compile a JSP page that
uses JSTL (1.0.1), I get a NullPointerException. Here's the setup
(apologies if my email client hoses long lines):

JAVA_HOME=C:\jdk1.3
CATALINA_HOME=D:\jakarta-tomcat-4.1.8
JASPER_HOME=D:\jakarta-tomcat-4.1.8

Here's how jspc gets invoked and the resulting error:

D:\jakarta-tomcat-4.1.8\webapps\jspcTest>%JASPER_HOME%\bin\jspc -v4 -d
WEB-INF\src\jspc -webinc WEB-INF\jspc-web.xml -uriroot . -webapp .
2002-08-09 09:07:44 - ERROR-the file '\index.jsp' generated the
following general exception: java.lang.NullPointerException
error:null

Here's index.jsp:

<%@ page language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
    <head><title>JSPC Test</title></head>
    <body><h1>Welcome to the JSPC test page</h1></body>
</html>

Here's web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

The only other components of the app are the JAR files for JSTL that are
installed in WEB-INF\lib. Everything works fine running as an app under
4.1.8. Any ideas about what's going on? Also, does the "v" flag really
do anything? I can't seem to get any verbose output no matter what it's
set to. Thanks for any help.

--
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


Error Using JSTL1.0.1

Posted by Lee Peik Feng <pf...@syabas.com>.
Hi,
    I'm using jdk1.3.1_04, tomcat 4.0.4 on Linux 7.3 and I have link up
apache and tomcat using mod_jk2.

    After I upgrade jstl from 1.0 to 1.0.1, I sometimes (not every time,
happen mainly after I update jsp files, clear cache and restart tomcat) get
the below error while trying to browse a jsp page.

I click on a link from a main page and the link is like this
http://mydomain/application/  (by default it will search for index.jsp)

and the browser address bar will return somthing like below
http://mydomain/application;jsessionid=42735B0A5AABE2DC6DA7212272E3CC3E
with a Page not found error.

but things will back to normal after I restart tomcat and clear cache again.
Sometimes, I can just go back to the main page, refresh my browser and
things will back to normal too without restarting tomcat.

I can't figure out what is the cause as it is not happenning all the time.



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


Re: Command line jspc throws NPE for page using JSTL

Posted by Kris Schneider <kr...@dotech.com>.
Hi Dave ;-),

I'm pretty sure it's meant to run standalone. The two "normal" ways I
know of are through the optional jspc Ant task or by running
%CATALINA_HOME%\bin\jspc.bat directly. Neither of those worked for me so
I went digging for some more detail about the failure. There's code in
the constructor of TagLibraryInfoImpl that strips a leading "/" off the
path before handing it off to JspCompilationContext.getResource which,
in turn, hands it off to JspCServletContext.getResource which explicitly
checks to see if the path starts with a "/".

David Kavanagh wrote:
> 
> Kris,
> Did you find the code that refers to that path? Is it assuming that is
> runs inside a webapp container? If so, sound like it might be a bug
> (unless it was never intended to run standalone). I'd bet you could make
> it work by messing with your classpath.
> 
> David
> 
> Kris Schneider wrote:
> 
> >I mucked around with the Jasper source a bit to get some exception info
> >dumped:
> >
> >java.net.MalformedURLException: Path 'WEB-INF/lib/standard.jar' does not
> >start with '/'
> >        at
> >org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:278)
> >        at
> >org.apache.jasper.JspCompilationContext.getResource(JspCompilationContext.java:235)
> >        at
> >org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:196)
> >        at
> >org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
> >        at
> >org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)
> >        at
> >org.apache.jasper.compiler.Parser.parseElements(Parser.java:790)
> >        at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
> >        at
> >org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
> >        at
> >org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
> >        at
> >org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:229)
> >        at org.apache.jasper.JspC.processFile(JspC.java:553)
> >        at org.apache.jasper.JspC.execute(JspC.java:778)
> >        at RunJspC.main(RunJspC.java:9)
> >
> >java.lang.NullPointerException
> >        at
> >org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:215)
> >        at
> >org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
> >        at
> >org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)
> >        at
> >org.apache.jasper.compiler.Parser.parseElements(Parser.java:790)
> >        at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
> >        at
> >org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
> >        at
> >org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
> >        at
> >org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:229)
> >        at org.apache.jasper.JspC.processFile(JspC.java:553)
> >        at org.apache.jasper.JspC.execute(JspC.java:778)
> >        at RunJspC.main(RunJspC.java:9)
> >
> >org.apache.jasper.JasperException
> >2002-08-09 10:55:36 - ERROR-the file '\index.jsp' generated the
> >following general exception: java.lang.NullPointerException
> >        at org.apache.jasper.JspC.processFile(JspC.java:574)
> >        at org.apache.jasper.JspC.execute(JspC.java:778)
> >        at RunJspC.main(RunJspC.java:9)
> >
> >My RunJspC class just does this:
> >
> >public static void main(String[] args) {
> >    try {
> >        JspC jspc = new JspC();
> >        jspc.setArgs(args);
> >        jspc.execute();
> >    } catch (JasperException exc) {
> >        exc.printStackTrace();
> >    }
> >}
> >
> >Kris Schneider wrote:
> >
> >>(Alrighty, this is actually attempt number 3 to get this note posted.
> >>Gotta get more caffeine to the gerbils powering the email server...)
> >>
> >>When I try to use jspc from the command line to compile a JSP page that
> >>uses JSTL (1.0.1), I get a NullPointerException. Here's the setup
> >>(apologies if my email client hoses long lines):
> >>
> >>JAVA_HOME=C:\jdk1.3
> >>CATALINA_HOME=D:\jakarta-tomcat-4.1.8
> >>JASPER_HOME=D:\jakarta-tomcat-4.1.8
> >>
> >>Here's how jspc gets invoked and the resulting error:
> >>
> >>D:\jakarta-tomcat-4.1.8\webapps\jspcTest>%JASPER_HOME%\bin\jspc -v4 -d
> >>WEB-INF\src\jspc -webinc WEB-INF\jspc-web.xml -uriroot . -webapp .
> >>2002-08-09 09:07:44 - ERROR-the file '\index.jsp' generated the
> >>following general exception: java.lang.NullPointerException
> >>error:null
> >>
> >>Here's index.jsp:
> >>
> >><%@ page language="java" %>
> >><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> >><html>
> >>    <head><title>JSPC Test</title></head>
> >>    <body><h1>Welcome to the JSPC test page</h1></body>
> >></html>
> >>
> >>Here's web.xml:
> >>
> >><?xml version="1.0" encoding="ISO-8859-1"?>
> >><!DOCTYPE web-app PUBLIC
> >>    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> >>    "http://java.sun.com/dtd/web-app_2_3.dtd">
> >><web-app>
> >>    <welcome-file-list>
> >>        <welcome-file>index.jsp</welcome-file>
> >>    </welcome-file-list>
> >></web-app>
> >>
> >>The only other components of the app are the JAR files for JSTL that are
> >>installed in WEB-INF\lib. Everything works fine running as an app under
> >>4.1.8. Any ideas about what's going on? Also, does the "v" flag really
> >>do anything? I can't seem to get any verbose output no matter what it's
> >>set to. Thanks for any help.
> >>
> >>--
> >>Kris Schneider <ma...@dotech.com>
> >>D.O.Tech       <http://www.dotech.com/>
> >>
> >>--
> >>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> >>For additional commands, e-mail: <ma...@jakarta.apache.org>
> >>
> >

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

Re: Command line jspc throws NPE for page using JSTL

Posted by David Kavanagh <da...@dotech.com>.
Kris,
Did you find the code that refers to that path? Is it assuming that is 
runs inside a webapp container? If so, sound like it might be a bug 
(unless it was never intended to run standalone). I'd bet you could make 
it work by messing with your classpath.

David

Kris Schneider wrote:

>I mucked around with the Jasper source a bit to get some exception info
>dumped:
>
>java.net.MalformedURLException: Path 'WEB-INF/lib/standard.jar' does not
>start with '/'
>        at
>org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:278)
>        at
>org.apache.jasper.JspCompilationContext.getResource(JspCompilationContext.java:235)
>        at
>org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:196)
>        at
>org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
>        at
>org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)
>        at
>org.apache.jasper.compiler.Parser.parseElements(Parser.java:790)
>        at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
>        at
>org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
>        at
>org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
>        at
>org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:229)
>        at org.apache.jasper.JspC.processFile(JspC.java:553)
>        at org.apache.jasper.JspC.execute(JspC.java:778)
>        at RunJspC.main(RunJspC.java:9)
>
>java.lang.NullPointerException
>        at
>org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:215)
>        at
>org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
>        at
>org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)
>        at
>org.apache.jasper.compiler.Parser.parseElements(Parser.java:790)
>        at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
>        at
>org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
>        at
>org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
>        at
>org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:229)
>        at org.apache.jasper.JspC.processFile(JspC.java:553)
>        at org.apache.jasper.JspC.execute(JspC.java:778)
>        at RunJspC.main(RunJspC.java:9)
>
>org.apache.jasper.JasperException
>2002-08-09 10:55:36 - ERROR-the file '\index.jsp' generated the
>following general exception: java.lang.NullPointerException
>        at org.apache.jasper.JspC.processFile(JspC.java:574)
>        at org.apache.jasper.JspC.execute(JspC.java:778)
>        at RunJspC.main(RunJspC.java:9)
>
>My RunJspC class just does this:
>
>public static void main(String[] args) {
>    try {
>        JspC jspc = new JspC();
>        jspc.setArgs(args);
>        jspc.execute();
>    } catch (JasperException exc) {
>        exc.printStackTrace();
>    }
>}
>
>Kris Schneider wrote:
>
>>(Alrighty, this is actually attempt number 3 to get this note posted.
>>Gotta get more caffeine to the gerbils powering the email server...)
>>
>>When I try to use jspc from the command line to compile a JSP page that
>>uses JSTL (1.0.1), I get a NullPointerException. Here's the setup
>>(apologies if my email client hoses long lines):
>>
>>JAVA_HOME=C:\jdk1.3
>>CATALINA_HOME=D:\jakarta-tomcat-4.1.8
>>JASPER_HOME=D:\jakarta-tomcat-4.1.8
>>
>>Here's how jspc gets invoked and the resulting error:
>>
>>D:\jakarta-tomcat-4.1.8\webapps\jspcTest>%JASPER_HOME%\bin\jspc -v4 -d
>>WEB-INF\src\jspc -webinc WEB-INF\jspc-web.xml -uriroot . -webapp .
>>2002-08-09 09:07:44 - ERROR-the file '\index.jsp' generated the
>>following general exception: java.lang.NullPointerException
>>error:null
>>
>>Here's index.jsp:
>>
>><%@ page language="java" %>
>><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
>><html>
>>    <head><title>JSPC Test</title></head>
>>    <body><h1>Welcome to the JSPC test page</h1></body>
>></html>
>>
>>Here's web.xml:
>>
>><?xml version="1.0" encoding="ISO-8859-1"?>
>><!DOCTYPE web-app PUBLIC
>>    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>>    "http://java.sun.com/dtd/web-app_2_3.dtd">
>><web-app>
>>    <welcome-file-list>
>>        <welcome-file>index.jsp</welcome-file>
>>    </welcome-file-list>
>></web-app>
>>
>>The only other components of the app are the JAR files for JSTL that are
>>installed in WEB-INF\lib. Everything works fine running as an app under
>>4.1.8. Any ideas about what's going on? Also, does the "v" flag really
>>do anything? I can't seem to get any verbose output no matter what it's
>>set to. Thanks for any help.
>>
>>--
>>Kris Schneider <ma...@dotech.com>
>>D.O.Tech       <http://www.dotech.com/>
>>
>>--
>>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>
>


Re: Command line jspc throws NPE for page using JSTL

Posted by Kris Schneider <kr...@dotech.com>.
I'm still interested to hear if anyone's actually gotten verbose output
to work. I tried configuring commons logging with log4j, but that didn't
seem to have any impact.

So, two potential workarounds came to mind. Only one of them succeeded,
but I think the one that failed uncovered another bug. Here's the one
that failed:

Keep taglib directive in JSP the same:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

Add a taglib element to web.xml:

<taglib>
  <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
  <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
</taglib>

Extract TLD from taglib JAR and place in /WEB-INF/tlds. This produces
the same error with the same args passed to the TagLibraryInfoImpl ctor:

prefix:   c
uriIn:    http://java.sun.com/jstl/core
location: { /WEB-INF/lib/standard.jar, META-INF/c.tld }

This seems to indicate that Jasper is replacing explicit taglib map
entries with implicit entries. According to the JSP 1.2 spec (JSP.7.3),
implicit entries should only be added if the value of their taglib-uri
is not already contained in the taglib map. With that in mind, here's
what does seem to work:

Modify the uri attribute of the taglib directive in JSP:

<%@ taglib prefix="c" uri="/tlds/jstl/core" %>

Add a taglib element to web.xml:

<taglib>
  <taglib-uri>/tlds/jstl/core</taglib-uri>
  <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
</taglib>

Extract TLD from taglib JAR and place in /WEB-INF/tlds. This results in
a clean run with the following args passed to the TagLibraryInfoImpl
ctor:

prefix:   c
uriIn:    /tlds/jstl/core
location: { /WEB-INF/tlds/c.tld, null }

I guess the next step should be to submit these as bugs, but I thought
I'd round out the thread in case anyone else runs into the same sort of
problem...

Quoting Kris Schneider <kr...@dotech.com>:

> Problem's still there in 4.1.9. Is this something I should move to the
> dev list? Has anyone gotten command line jspc to work for tag libraries
> packaged similarly to JSTL? Struts demonstrates the same problem (same
> web.xml):
> 
> index.jsp:
> 
> <%@ page language="java" %>
> <%@ taglib prefix="struts-html"
> uri="http://jakarta.apache.org/struts/tags-html-1.0.2" %>
> <html>
>     <head><title>JSPC Test</title></head>
>     <body><h1>Welcome to the JSPC test page</h1></body>
> </html>
> 
> TagLibraryInfoImpl constructor args:
> 
> prefix:   struts-html
> uriIn:    http://jakarta.apache.org/struts/tags-html-1.0.2
> location: { /WEB-INF/lib/struts.jar, META-INF/tlds/struts-html.tld }
> 
> Kris Schneider wrote:
> > 
> > From the original note:
> > 
> > > Here's index.jsp:
> > >
> > > <%@ page language="java" %>
> > > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> > > <html>
> > >     <head><title>JSPC Test</title></head>
> > >     <body><h1>Welcome to the JSPC test page</h1></body>
> > > </html>
> > >
> > > Here's web.xml:
> > >
> > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > <!DOCTYPE web-app PUBLIC
> > >     "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> > >     "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > <web-app>
> > >     <welcome-file-list>
> > >         <welcome-file>index.jsp</welcome-file>
> > >     </welcome-file-list>
> > > </web-app>
> > 
> > All I'm doing is referencing the taglib URI in the directive. Jasper
> > should be doing the work of generating the path through an implicit
> > taglib map entry, right? This does work when the app is actually run
> > within a container. Here are some of the args passed to the
> > TagLibraryInfoImpl constructor:
> > 
> > prefix:   c
> > uriIn:    http://java.sun.com/jstl/core
> > location: { /WEB-INF/lib/standard.jar, META-INF/c.tld }
> > 
> > And here's the test that causes the leading "/" to get stripped (path
> =
> > location[0] = /WEB-INF/lib/standard.jar):
> > 
> > if (ctxt.getClassLoader() != null &&
> >     URLClassLoader.class.equals(ctxt.getClassLoader().getClass()) &&
> >     path.startsWith("/"))
> > 
> > "Craig R. McClanahan" wrote:
> > >
> > > On Fri, 9 Aug 2002, Kris Schneider wrote:
> > >
> > > > Date: Fri, 09 Aug 2002 23:11:48 -0400
> > > > From: Kris Schneider <kr...@dotech.com>
> > > > Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> > > > To: Tomcat Users List <to...@jakarta.apache.org>
> > > > Subject: Re: Command line jspc throws NPE for page using JSTL
> > > >
> > > > I mucked around with the Jasper source a bit to get some exception
> info
> > > > dumped:
> > > >
> > > > java.net.MalformedURLException: Path 'WEB-INF/lib/standard.jar'
> does not
> > > > start with '/'
> > >
> > > Have you verified that your application's use of the path to the
> taglib
> > > URL, in web.xml or in a <%@ taglib %> directive of a JSP page, do
> not use
> > > this kind of invalid reference?
> > >
> > > Craig
> > >
> > > --
> > > To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > 
> > --
> > Kris Schneider <ma...@dotech.com>
> > D.O.Tech       <http://www.dotech.com/>
> 
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>

--
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


Re: Command line jspc throws NPE for page using JSTL

Posted by Kris Schneider <kr...@dotech.com>.
Problem's still there in 4.1.9. Is this something I should move to the
dev list? Has anyone gotten command line jspc to work for tag libraries
packaged similarly to JSTL? Struts demonstrates the same problem (same
web.xml):

index.jsp:

<%@ page language="java" %>
<%@ taglib prefix="struts-html"
uri="http://jakarta.apache.org/struts/tags-html-1.0.2" %>
<html>
    <head><title>JSPC Test</title></head>
    <body><h1>Welcome to the JSPC test page</h1></body>
</html>

TagLibraryInfoImpl constructor args:

prefix:   struts-html
uriIn:    http://jakarta.apache.org/struts/tags-html-1.0.2
location: { /WEB-INF/lib/struts.jar, META-INF/tlds/struts-html.tld }

Kris Schneider wrote:
> 
> From the original note:
> 
> > Here's index.jsp:
> >
> > <%@ page language="java" %>
> > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> > <html>
> >     <head><title>JSPC Test</title></head>
> >     <body><h1>Welcome to the JSPC test page</h1></body>
> > </html>
> >
> > Here's web.xml:
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <!DOCTYPE web-app PUBLIC
> >     "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> >     "http://java.sun.com/dtd/web-app_2_3.dtd">
> > <web-app>
> >     <welcome-file-list>
> >         <welcome-file>index.jsp</welcome-file>
> >     </welcome-file-list>
> > </web-app>
> 
> All I'm doing is referencing the taglib URI in the directive. Jasper
> should be doing the work of generating the path through an implicit
> taglib map entry, right? This does work when the app is actually run
> within a container. Here are some of the args passed to the
> TagLibraryInfoImpl constructor:
> 
> prefix:   c
> uriIn:    http://java.sun.com/jstl/core
> location: { /WEB-INF/lib/standard.jar, META-INF/c.tld }
> 
> And here's the test that causes the leading "/" to get stripped (path =
> location[0] = /WEB-INF/lib/standard.jar):
> 
> if (ctxt.getClassLoader() != null &&
>     URLClassLoader.class.equals(ctxt.getClassLoader().getClass()) &&
>     path.startsWith("/"))
> 
> "Craig R. McClanahan" wrote:
> >
> > On Fri, 9 Aug 2002, Kris Schneider wrote:
> >
> > > Date: Fri, 09 Aug 2002 23:11:48 -0400
> > > From: Kris Schneider <kr...@dotech.com>
> > > Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> > > To: Tomcat Users List <to...@jakarta.apache.org>
> > > Subject: Re: Command line jspc throws NPE for page using JSTL
> > >
> > > I mucked around with the Jasper source a bit to get some exception info
> > > dumped:
> > >
> > > java.net.MalformedURLException: Path 'WEB-INF/lib/standard.jar' does not
> > > start with '/'
> >
> > Have you verified that your application's use of the path to the taglib
> > URL, in web.xml or in a <%@ taglib %> directive of a JSP page, do not use
> > this kind of invalid reference?
> >
> > Craig
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> --
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

Re: Command line jspc throws NPE for page using JSTL

Posted by Kris Schneider <kr...@dotech.com>.
>>From the original note:

> Here's index.jsp:
> 
> <%@ page language="java" %>
> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> <html>
>     <head><title>JSPC Test</title></head>
>     <body><h1>Welcome to the JSPC test page</h1></body>
> </html>
> 
> Here's web.xml:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app PUBLIC
>     "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>     <welcome-file-list>
>         <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
> </web-app>

All I'm doing is referencing the taglib URI in the directive. Jasper
should be doing the work of generating the path through an implicit
taglib map entry, right? This does work when the app is actually run
within a container. Here are some of the args passed to the
TagLibraryInfoImpl constructor:

prefix:   c
uriIn:    http://java.sun.com/jstl/core
location: { /WEB-INF/lib/standard.jar, META-INF/c.tld }

And here's the test that causes the leading "/" to get stripped (path =
location[0] = /WEB-INF/lib/standard.jar):

if (ctxt.getClassLoader() != null &&
    URLClassLoader.class.equals(ctxt.getClassLoader().getClass()) &&
    path.startsWith("/"))

"Craig R. McClanahan" wrote:
> 
> On Fri, 9 Aug 2002, Kris Schneider wrote:
> 
> > Date: Fri, 09 Aug 2002 23:11:48 -0400
> > From: Kris Schneider <kr...@dotech.com>
> > Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> > To: Tomcat Users List <to...@jakarta.apache.org>
> > Subject: Re: Command line jspc throws NPE for page using JSTL
> >
> > I mucked around with the Jasper source a bit to get some exception info
> > dumped:
> >
> > java.net.MalformedURLException: Path 'WEB-INF/lib/standard.jar' does not
> > start with '/'
> 
> Have you verified that your application's use of the path to the taglib
> URL, in web.xml or in a <%@ taglib %> directive of a JSP page, do not use
> this kind of invalid reference?
> 
> Craig
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

Re: Command line jspc throws NPE for page using JSTL

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 9 Aug 2002, Kris Schneider wrote:

> Date: Fri, 09 Aug 2002 23:11:48 -0400
> From: Kris Schneider <kr...@dotech.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Re: Command line jspc throws NPE for page using JSTL
>
> I mucked around with the Jasper source a bit to get some exception info
> dumped:
>
> java.net.MalformedURLException: Path 'WEB-INF/lib/standard.jar' does not
> start with '/'

Have you verified that your application's use of the path to the taglib
URL, in web.xml or in a <%@ taglib %> directive of a JSP page, do not use
this kind of invalid reference?

Craig



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


Re: Command line jspc throws NPE for page using JSTL

Posted by Kris Schneider <kr...@dotech.com>.
I mucked around with the Jasper source a bit to get some exception info
dumped:

java.net.MalformedURLException: Path 'WEB-INF/lib/standard.jar' does not
start with '/'
        at
org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:278)
        at
org.apache.jasper.JspCompilationContext.getResource(JspCompilationContext.java:235)
        at
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:196)
        at
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
        at
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)
        at
org.apache.jasper.compiler.Parser.parseElements(Parser.java:790)
        at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
        at
org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
        at
org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
        at
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:229)
        at org.apache.jasper.JspC.processFile(JspC.java:553)
        at org.apache.jasper.JspC.execute(JspC.java:778)
        at RunJspC.main(RunJspC.java:9)

java.lang.NullPointerException
        at
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:215)
        at
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
        at
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)
        at
org.apache.jasper.compiler.Parser.parseElements(Parser.java:790)
        at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
        at
org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
        at
org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
        at
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:229)
        at org.apache.jasper.JspC.processFile(JspC.java:553)
        at org.apache.jasper.JspC.execute(JspC.java:778)
        at RunJspC.main(RunJspC.java:9)

org.apache.jasper.JasperException
2002-08-09 10:55:36 - ERROR-the file '\index.jsp' generated the
following general exception: java.lang.NullPointerException
        at org.apache.jasper.JspC.processFile(JspC.java:574)
        at org.apache.jasper.JspC.execute(JspC.java:778)
        at RunJspC.main(RunJspC.java:9)

My RunJspC class just does this:

public static void main(String[] args) {
    try {
        JspC jspc = new JspC();
        jspc.setArgs(args);
        jspc.execute();
    } catch (JasperException exc) {
        exc.printStackTrace();
    }
}

Kris Schneider wrote:
> 
> (Alrighty, this is actually attempt number 3 to get this note posted.
> Gotta get more caffeine to the gerbils powering the email server...)
> 
> When I try to use jspc from the command line to compile a JSP page that
> uses JSTL (1.0.1), I get a NullPointerException. Here's the setup
> (apologies if my email client hoses long lines):
> 
> JAVA_HOME=C:\jdk1.3
> CATALINA_HOME=D:\jakarta-tomcat-4.1.8
> JASPER_HOME=D:\jakarta-tomcat-4.1.8
> 
> Here's how jspc gets invoked and the resulting error:
> 
> D:\jakarta-tomcat-4.1.8\webapps\jspcTest>%JASPER_HOME%\bin\jspc -v4 -d
> WEB-INF\src\jspc -webinc WEB-INF\jspc-web.xml -uriroot . -webapp .
> 2002-08-09 09:07:44 - ERROR-the file '\index.jsp' generated the
> following general exception: java.lang.NullPointerException
> error:null
> 
> Here's index.jsp:
> 
> <%@ page language="java" %>
> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> <html>
>     <head><title>JSPC Test</title></head>
>     <body><h1>Welcome to the JSPC test page</h1></body>
> </html>
> 
> Here's web.xml:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app PUBLIC
>     "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>     <welcome-file-list>
>         <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
> </web-app>
> 
> The only other components of the app are the JAR files for JSTL that are
> installed in WEB-INF\lib. Everything works fine running as an app under
> 4.1.8. Any ideas about what's going on? Also, does the "v" flag really
> do anything? I can't seem to get any verbose output no matter what it's
> set to. Thanks for any help.
> 
> --
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>