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 2014/01/13 06:55:30 UTC

[Bug 55995] New: java.lang.NullPointerException at org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)

https://issues.apache.org/bugzilla/show_bug.cgi?id=55995

            Bug ID: 55995
           Summary: java.lang.NullPointerException at
                    org.apache.jasper.servlet.JspCServletContext.getResour
                    ce(JspCServletContext.java:344)
           Product: Tomcat 8
           Version: 8.0.0-RC10
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: peter_lenahan@ibi.com

Null pointer exception when running JSPC from a Shell Script.

JspCServletContext.java:344
    /**
     * Return a URL object of a resource that is mapped to the
     * specified context-relative path.
     *
     * @param path Context-relative path of the desired resource
     *
     * @exception MalformedURLException if the resource path is
     *  not properly formed
     */
    @Override
    public URL getResource(String path) throws MalformedURLException {

        if (!path.startsWith("/"))
            throw new MalformedURLException("Path '" + path +
                                            "' does not start with '/'");

TldCache.java:124

    private long[] getLastModified(TldResourcePath tldResourcePath) {
        long[] result = new long[2];
        result[0] = -1;
        result[1] = -1;
        try {
            URL url =
servletContext.getResource(tldResourcePath.getWebappPath());


/usr/java/jdk1.7.0_45/bin/java -classpath
:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/catalina-storeconfig.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-websocket.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-i18n-es.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/catalina-tribes.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/catalina-ha.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-i18n-ja.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/jsp-api.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-util.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-jni.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/jasper.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/websocket-api.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/ecj-4.3.1.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-i18n-fr.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-api.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-coyote.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/servlet-api.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/jasper-el
 .jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/catalina.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-dbcp.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-jdbc.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/annotations-api.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-util-scan.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/catalina-ant.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/el-api.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/lib/tomcat-spdy.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/bin/tomcat-juli.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/bin/bootstrap.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/bin/commons-daemon.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/webapps/examples/WEB-INF/lib/jstl.jar:/home/tomcat/apache-tomcat-8.0.0-RC10/webapps/examples/WEB-INF/lib/standard.jar:/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/lib/ant-1.6.5.jar
org.apache.jasper.JspC     -d /home/java/source/HEAD/work/tomcat80     -v    
-l     -uriroot /home/java/source/HEAD/work/jsp_compile_shared
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/dialog/qbAxesDlg.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/dialog/qbManualGecodingDlg.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/fmtdlg.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/index.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/joindlg.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/producer.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/simplefilter.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/selectvaluedlg.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/binddowsTestView.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/variableeditordlg.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/filterprompteditor.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/ajax_response.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/fontdlg.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/join_fields.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/tree_component.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/waiting_banner.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/folderblock/BID_FolderBlockInit.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/folderblock/BID_FolderBlockBoot.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/BID_EmptyContent.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/xml/BID_UrlProperties.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/xml/BID_IBFSpathToHrefs.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/xml/BID_xmlresponse.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/xml/BID_statusResponse.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/favorites/BID_favorites_tree.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/favorites/BID_FavoritesBlockBoot.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/favorites/BID_FavoritesBlockInit.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/favorites/BID_favorites_tree_boot.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/favorites/BID_listToXML.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/index.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_InternalPage.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_SearchTree_Boot.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_SATree_Boot.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_BiFrame.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_initView.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_ShowToolbar.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_ExternalPage.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_SATreeBiFrame.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_initBindows.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/views/BID_SearchTreeBiFrame.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/recents/BID_recents_tree_boot.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/recents/BID_recents_tree.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/recents/BID_listToXML.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/error.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/groups/BID_listToXML.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/search/BID_searchListToXML.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/search/BID_listToXML.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/tree/BID_MrPropertiesToXML.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/tree/BID_flatListToXML.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/tree/BID_PlainText.jsp
/home/java/source/HEAD/work/jsp_compile_shared/WEB-INF/jsp/bid/tree/BID_listToXML.jsp
     2>&1


Exception in thread "main" java.lang.NullPointerException
    at
org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)
    at org.apache.jasper.compiler.TldCache.getLastModified(TldCache.java:124)
    at org.apache.jasper.compiler.TldCache.<init>(TldCache.java:70)
    at org.apache.jasper.JspC.initServletContext(JspC.java:1468)
    at org.apache.jasper.JspC.execute(JspC.java:1321)
    at org.apache.jasper.JspC.main(JspC.java:269)

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 55995] java.lang.NullPointerException at org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55995

--- Comment #5 from Peter Lenahan <pe...@ibi.com> ---
Konstantin, Mark,

Thank you both for reproducing the problem in a better way and fixing it so
fast.

Peter

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 55995] java.lang.NullPointerException at org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55995

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Thanks for the test case. The bit I was missing as explicitly putting the JARs
containing TLDs on the class path.

This has been fixed in 8.0.x and will be included in 8.0.0 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 55995] java.lang.NullPointerException at org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55995

--- Comment #3 from Konstantin Kolinko <kn...@gmail.com> ---
Created attachment 31203
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31203&action=edit
jspc_55995_test.bat

I can reproduce this NPE with 8.0-RC10 and with trunk.

See the attached Windows batch file. Essentially, it uses Tomcat's
bin/cpappend.bat to reproduce classpath from Comment 0. That is

1. ant.jar
2. all jars from %CATALINA_HOME%\bin and %CATALINA_HOME%\lib
3. libs from the examples webapp (the JSTL jars)

Then it tries to compile examples\jsp\tagplugin\choose.jsp.
This results in the same NullPointerException, as reported by OP.

Exception in thread "main" java.lang.NullPointerException
        at
org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)
        at
org.apache.jasper.compiler.TldCache.getLastModified(TldCache.java:124)
        at org.apache.jasper.compiler.TldCache.<init>(TldCache.java:70)
        at org.apache.jasper.JspC.initServletContext(JspC.java:1468)
        at org.apache.jasper.JspC.execute(JspC.java:1321)
        at org.apache.jasper.JspC.main(JspC.java:269)

4. If I comment-out the line that adds JSTL jars to the classpath,
JspC completes successfully and generates Java source text for the page.
Note, that the JSTL tag library in the WEB-INF/lib directory of the web
application is successfully recognized and processed by JspC.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 55995] java.lang.NullPointerException at org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55995

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
I can't reproduce this with the latest 8.0.x source. Neither do I see anything
in the change history since RC10 that looks like it would have fixed this.

Without the JSP source it is hard to see what might be triggering this. Please
provide the simplest possible JSP that demonstrates this issue along with any
additional files (tags etc) that may be required to reproduce it.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 55995] java.lang.NullPointerException at org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55995

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Drop severity to a realistic level. It isn't functionality used by most users
and in at least some cases JspC still works.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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