quality@glassfish.java.net

[Fwd: [webtier] WG: Weird Jsp-compilation problem in the Jasper-component]

From: Adam Bien <abien_at_adam-bien.com>
Date: Sat, 13 Sep 2008 22:08:15 +0200

The problem, which I filed:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=5980. Seems to
occur in other apps as well.
See attached email... (found it on a mailing list...) With liferay it
was hard to reproduce - but I would classify it as severe one...

regards,

adam

   


attached mail follows:



Hi Glassfish Community,

i recently had a weird Jsp-compilation problem in the
Glassfish-Jasper-component (running inside a Jetty webserver):

A simple web-app (see http://www.photonensturm.de/Testing.war) with the
following files:

/jsp/test.jsp
/META-INF/manifest.mf
/WEB-INF/web.xml
/WEB-INF/classes/de/Testing.class
/WEB-INF/classes/de/testing/Test.class

In test.jsp, i have an import of class Test:
<%@ page import="de.testing.Test"%>

But when the jsp is being compiled by the JDT-Eclipse-Compiler, i get the
exception:

org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP

PWC6199: Generated servlet error:
The import de.testing cannot be resolved

PWC6197: An error occurred at line: 7 in the jsp file: /jsp/test.jsp
PWC6199: Generated servlet error:
Test cannot be resolved to a type


at
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandle
r.java:107)
at
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:2
80)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:350)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:411)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
92)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
44)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerColl
ection.java:206)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:11
4)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnectio
n.java:829)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488
)

It stumbles over the class de.Testing with the same name as the package. I
tested the web-app in Tomcat 6.0.16 successfully which is using the
jasper-jdt-component as well (at least i think it does as the library is in
there - but it might be different from the Glassfish-version).

I could track that down to a method in class JDTJavaCompiler:
private boolean isPackage(String result)

The argument "de.testing" is modified to "de/testing.class" and afterwards
is trying to open an InputStream by the classloader. Therefore the method
returns false (no package) under Windows-OS but should return true.

Hhmmm, is my analysis correct? Perhaps this error was fixed in a newer
version than the one that is used in Jetty (6.1.11 from June 2008). If not,
we should take a look at the JDTJavaCompiler in Tomcat-Jasper?...

Hope that someone can comment on this. At the moment i try to avoid such
filename-constellations.


Cheers,
Michael



---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net