| Summary: | NullPointerException is thrown when forwarding to a JSP in a snap bundle from ExceptionResolver | ||
|---|---|---|---|
| Product: | [RT] Virgo | Reporter: | Sven Panko <sven.panko> |
| Component: | snaps | Assignee: | Dmitry Sklyut <dmitry> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | dmarthaler, dmitry, eclipse |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Sven Panko
As requested in the corresponding mailinglist topic (http://www.eclipse.org/forums/index.php?t=msg&th=203933), these are the OSGi manifest headers in use: Snap-Host: Bundle-SymbolicName: purchase.interface Bundle-Version: 1.0.0.SNAPSHOT Web-ContextPath: /purchase Snap-Bundle: Snap-Host: purchase.interface;version="1.0.0" Bundle-Version: 1.0.0.SNAPSHOT Snap-ContextPath: /callback Note that although the host's version is 1.0.0.SNAPSHOT the snap successfully attaches itself to it, despite the explicit mentioning of the host's version "1.0.0". One thing that caught my eye: Is there a specific reason that jsp servlet url-pattern is modified in the snap? i.e. <servlet-mapping> <servlet-name>jsp</servlet-name> <url-pattern>/WEB-INF/views/*</url-pattern> </servlet-mapping> Thanks Dmitry A bit of research: Snaps includes its own copy of default servlets that is different from the one included by stock gemini tomcat. see: /org.eclipse.virgo.snaps.core/src/main/resources/META-INF/snaps/default-web.xml In this configuration JspServlet is named "__jsp-servlet" not "jsp" gemini-web on the other hand will look for web.xml in config and if not found use /org.eclipse.gemini.web.tomcat/src/main/resources/web-embed.xml as a default web.xml In that configuration JspServlet is named "jsp". ==== The work around for now is to use __jsp-servlet when working with snaps to get past NPE. I think a potential solution is to stop snap deployment if merged web.xml is missing a servlet definition, i.e. only has a servlet-mapping but no servlet config. Another thing to look at is why snaps and gemini should have different default web.xml configurations. Can they be merged? Do they have to be different? What about snaps and jetty? Could that default web.xml be made discoverable with a service publication? Some more research: 1. org.eclipse.virgo.snaps.core.internal.webapp.container.ServletManager.processServletMappingDefinitions already has a comment to check mapping vs. servlet config. i.e. // TODO Validate, probably in WebXml, the referenced servlets exist, etc 2. There are two good places to plug in with validation: a. org.eclipse.virgo.snaps.core.internal.webapp.config.BundleWebXmlLoader.loadWebXml b. or as the comment in #1 mentioned - add validate() method on the WebXml. Thoughts? This bug has an assignee, so changing status to ASSIGNED. Rudimentary validation fix: check for missing servlets/filters. Commits: 7f2ec88e267651dace666ebb2e2e0beabee5d9d2 and 0bea5f2145b81ee5bd6a461eb7ab9a279118bcf2 Verified for 3.7.0.RC01 |