You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/01/29 10:05:58 UTC

DO NOT REPLY [Bug 16532] New: - TagLibraryInfoImpl produces NullPointerException

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16532>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16532

TagLibraryInfoImpl produces NullPointerException

           Summary: TagLibraryInfoImpl produces NullPointerException
           Product: Tomcat 4
           Version: 4.1.12
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper 2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: wosc@wosc.de


I ran JspC via the ant-task proposed by the JavaDocs (<taskdef 
classname="org.apache.jasper.JspC" name="jasper2"/>) on a I think quite normal webapp like 
so:
    <jasper2 verbose="0"
      uriroot="${webapp.dir}"
      outputDir="${jsp.output.dir}"
      
classDebugInfo="true"
      compile="true"/>
(running directly from jspc.sh made no 
difference to the problem.)

But this failed at the first file with a NullPointerException in 
TagLibraryInfoImpl around line 212, which is a catch clause stating
		Constants.message(
                    
"jsp.error.taglib.jarFileException",
		    new Object[] {url.toString(), 
ex.getMessage()},
		    Logger.ERROR);

But url is null in my situation.
I investigated 
the cause and found it to be around line 192 which says
            if(ctxt.getClassLoader() != null &&
              
URLClassLoader.class.equals(ctxt.getClassLoader().getClass())
                  && 
path.startsWith("/"))
              path = path.substring(1,path.length());

In my situation this 
resulted in the paths to JARs of taglibs I use to be truncated from "/WEB-INF/lib/thejar.jar" to 
"WEB-INF/lib/thejar.jar", which in turn of course causes a MalformedURLException at the next 
line,
            url = ctxt.getResource(path);
which is caught at the well-known catch-clause - but url is 
null!

Frankly, I don't understand the URLClassLoader thing at all, but what I do understand 
is that the catch-clause, which would have reported the malformed URL or some other useful 
Exception containing information about the problem at hand, instead produces a genuinely 
unhelpful NullPointerException.

What confuses me most, though, is this: after I removed 
the URLClassloader-statements, JspC compiled my webapp just fine...

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org