Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] JSP class loader can not load bytecode from the filesystem

I came across a bug in Jetty JSP which only developers can fix.

Jetty uses jsp-2.1-glassfish jar from org.mortbay.jettyto provide JSP support. There is a bug in the glassfish JSP implementation in org.apache.jasper.servlet.JasperLoader.findClass:

        if (cdata == null) {
            // If the bytecode preprocessor is not enabled, use super.findClass
   	        // as usual.
            if (!PreprocessorUtil.isPreprocessorEnabled()) { 
                return super.findClass(className);
            // read class data from file
            cdata = loadClassDataFromFile(path);

The thing is, that test for enabled preprocessor returns false in majority of cases and execution never goes to the loading bytecode from the file system. Call to URLClassLoader.findClass simply throws a ClassNotFound exception (resulting in HTTP 500 later on).

Of course most of the time class for JSP either loaded or its bytecode exists in the memory. But still there are cases (for very rarely used page) to hit this path. For that reason there is no solid repro for this bug. The only condition I am aware about, is that any JSP page should not be hit for several weeks.

Lines 185-190 can be safely removed. Or Jetty may use other JSP class.

I am going to look for the configuration on the client side to use other JSP library, but that is not a topic for the jetty-dev list.

The bug was reported several times against different projects (based on the same reference JSP implementation from Glassfish) but never cought any attention from the developers. They may be googled by "org.apache.jasper.JasperException: PWC6034: Unable to load class for JSP" message.

I hope you'll consider this message and fix the issue in some future version. I'd prefer if Jetty uses open source JSP library. But that's not for me to decide.

  Aleksey Vorona

Back to the top