Problem Integrating OSGi, Jetty 6, and Glassfish Jasper [message #103234] |
Fri, 04 January 2008 02:55 |
Eclipse User |
|
|
|
Originally posted by: milo24x7.gmail.com
I am trying to integrate OSGi 3.3.1.1, Jetty 6.1.6, and the Glassfish
version of the Apache Jasper JSP compiler as an embedded web server in a
desktop application. The Server-Side Equinox project uses Jetty 5, so
I've resorted to rolling my own bridge code instead of relying on the
Equinox Http Service implementation. In addition, I want the flexibility
to serve pages from the file system in addition to serving pages packaged
in OSGi bundles (unless I am mistaken, this is not a typical feature of
the Server-Side Equinox implementation).
For the most part, things are working pretty well. The application is
able to serve static content just fine using the Jetty Default Servlet.
If I point the web root at the file system, I can also serve JSP pages,
including cool things like the JSTL tag library.
The problem comes when I try to serve JSP pages that are packaged in an
OSGi bundle:
2008-01-03 07:47:33.013::WARN: /scripts/scriptaculous.js
java.lang.NullPointerException
at java.util.zip.Inflater.ensureOpen(Unknown Source)
at java.util.zip.Inflater.reset(Unknown Source)
at java.util.zip.ZipFile.getInflater(Unknown Source)
at java.util.zip.ZipFile.getInputStream(Unknown Source)
at java.util.zip.ZipFile.getInputStream(Unknown Source)
at
org.eclipse.osgi.baseadaptor.bundlefile.ZipBundleEntry.getIn putStream(ZipBundleEntry.java:51)
at
org.eclipse.osgi.framework.internal.core.BundleURLConnection .connect(BundleURLConnection.java:53)
at
org.eclipse.osgi.framework.internal.core.BundleURLConnection .getInputStream(BundleURLConnection.java:99)
at org.mortbay.resource.URLResource.exists(URLResource.java:101 )
at
org.mortbay.jetty.servlet.DefaultServlet.doGet(DefaultServle t.java:398)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
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(ServletHandl er.java:362)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandl er.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandl er.java:712)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapp er.java:139)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnectio n.java:506)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComple te(HttpConnection.java:829)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java: 211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java: 381)
at
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketC onnector.java:227)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedT hreadPool.java:442)
When I try to retrieve the above file "scriptaculous.js" directly using
the browser, it works fine. It's only a problem when the javascript or
css file is referenced from within a JSP file.
There are very sparse priors on this type of issue. A google search on
the NullPointerException thrown from java.util.zip.Inflater.ensureOpen
only returns a few message boards with people asking dissimilar questions
that were never answered satisfactorily.
I have resorted to analyzing the source code for the JDK, OSGi framework,
and Jetty. It appears that the only way this kind of exception can be
thrown is if someone closes the ZipFile prematurely. Closing the ZipFile
will invalidate all of the Inflater objects associated with it, and will
result in a NullPointerException being thrown from the ensureOpen() method
on line 333 of java.util.zip.Inflater.java in JDK 6, dated 06/04/07.
My problem is that I have no idea why that would be happening, and I can't
think of a way to localize the bug to the JDK, OSGi framework, Jetty, or
Jasper.
I'm willing to entertain the idea that the bug is in my code, except that
I didn't really write any code related to this. All I am doing is
configuring Jetty/Jasper with a URL identifying "bundleentry://12/web" as
the web root.
Any suggestions on how to proceed would be most appreciated.
Thanks and happy new year.
--milo
|
|
|
|
Powered by
FUDForum. Page generated in 1.18320 seconds