Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Snaps-based app doesn't allow welcome files?
Snaps-based app doesn't allow welcome files? [message #817193] Fri, 09 March 2012 19:24 Go to next message
Jason Levine is currently offline Jason LevineFriend
Messages: 12
Registered: July 2009
Junior Member
I'm building a Snaps-based web app as a first project, and have noticed that Snaps doesn't allow me to use a list of welcome files (in the web.xml <welcome-file-list> element) -- from the logs, it appears that a null path request gets shunted through the StaticResourceServlet instead. Is there some configuration I'm missing?

For reference, my snap is configured to respond at /lm/spring/. The request that fails is a request for that same URL. Here's my web.xml, with the root element removed because this forum won't let me post it due to the fact that it includes URLs:

	<display-name>LM Portal Spring Module</display-name>

	<!-- configure our parent application context -->
	<context-param>
		<param-name>contextClass</param-name>
		<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
	</context-param>

	<!-- set up the standard Spring context listener -->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<!-- create our standard Spring dispatcher servlet -->
	<servlet>
		<servlet-name>springModule</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>springModule</servlet-name>
		<url-pattern>/w/*</url-pattern>
	</servlet-mapping>

	<welcome-file-list>
		<!-- this doesn't appear to work with Virgo Snaps... -->
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>


And my servlet's context (springModule-servlet.xml); same thing, the root element has been removed due to this forum's crankiness:

	<context:component-scan base-package="gov.cancer.ccr.oit.lmportal.spring.web" />

	<!-- configure our view resolver -->
	<bean id="topViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>


And finally, here's the log.log entries for the request for /lm/spring/:

[2012-03-09 13:50:26.007] INFO  http-bio-8080-exec-4         org.eclipse.virgo.snaps.core.OsgiSnapRegistry                     Snap 'org.eclipse.virgo.snaps.core.internal.webapp.WebAppSnap@4eb15265' found for context path '/spring' 
[2012-03-09 13:50:26.007] INFO  http-bio-8080-exec-4         o.e.v.s.c.i.w.c.StandardVirtualContainerRequestDispatcher         Servicing request 'null' 
[2012-03-09 13:50:26.007] INFO  http-bio-8080-exec-4         org.eclipse.virgo.snaps.core.internal.webapp.url.PathUrlPattern   Path '/spring/' does not match pattern '/spring/w' 
[2012-03-09 13:50:26.007] INFO  http-bio-8080-exec-4         o.e.virgo.snaps.core.internal.webapp.url.ExtensionUrlPattern      Path '/spring/' does not match pattern 'jsp' 
[2012-03-09 13:50:26.007] INFO  http-bio-8080-exec-4         o.eclipse.virgo.snaps.core.internal.webapp.url.DefaultUrlPattern  Path '/spring/' matches pattern '/' 
[2012-03-09 13:50:26.007] INFO  http-bio-8080-exec-4         o.eclipse.virgo.snaps.core.internal.webapp.url.UrlPatternMatcher  Matched path '/spring/' with mapping '__resource-servlet' 
[2012-03-09 13:50:26.008] INFO  http-bio-8080-exec-4         o.eclipse.virgo.snaps.core.internal.webapp.url.DefaultUrlPattern  Translated path '/spring' to '/' 
[2012-03-09 13:50:26.008] INFO  http-bio-8080-exec-4         o.eclipse.virgo.snaps.core.internal.webapp.StaticResourceServlet  Resource / found 
[2012-03-09 13:50:26.012] ERROR http-bio-8080-exec-4         o.a.c.core.ContainerBase.[Catalina].[localhost].[/lm].[default]   Servlet.service() for servlet [default] in context with path [/lm] threw exception java.io.FileNotFoundException: /Users/levineja/Downloads/virgo-tomcat-server-3.0.2.RELEASE/work/org.eclipse.virgo.kernel.deployer_3.0.2.RELEASE/staging/global/bundle/gov.cancer.ccr.oit.lmportal-spring/1.0.0/lmportal-spring-1.0.0.jar/ (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:120)
	at org.eclipse.osgi.framework.util.SecureAction.getFileInputStream(SecureAction.java:123)
	at org.eclipse.osgi.baseadaptor.bundlefile.FileBundleEntry.getInputStream(FileBundleEntry.java:56)
	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 java.net.URL.openStream(URL.java:1010)
	at org.eclipse.virgo.snaps.core.internal.webapp.StaticResourceServlet.doGet(StaticResourceServlet.java:66)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.ImmutableFilterChain.doFilter(ImmutableFilterChain.java:47)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher$1.doWithClassLoader(StandardVirtualContainerRequestDispatcher.java:104)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher$1.doWithClassLoader(StandardVirtualContainerRequestDispatcher.java:1)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher.doWithThreadContextClassLoader(StandardVirtualContainerRequestDispatcher.java:121)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher.service(StandardVirtualContainerRequestDispatcher.java:101)
	at org.eclipse.virgo.snaps.core.internal.webapp.WebAppSnap.handleRequest(WebAppSnap.java:152)
	at org.eclipse.virgo.snaps.core.RequestRouter.service(RequestRouter.java:51)
	at org.eclipse.virgo.snaps.core.SnapHostFilter.doFilter(SnapHostFilter.java:62)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.eclipse.virgo.web.tomcat.support.ApplicationNameTrackingValve.invoke(ApplicationNameTrackingValve.java:33)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)


Requests for /lm/spring/index.jsp return the index.jsp that's at that location, so that's fine -- it's just the null-path -- /lm/spring/ -- that's failing.
Re: Snaps-based app doesn't allow welcome files? [message #820045 is a reply to message #817193] Tue, 13 March 2012 16:57 Go to previous messageGo to next message
Chris Frost is currently offline Chris FrostFriend
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

Could you show the web.xml for the host as well please. What is the full context path you are requesting as for just "/lm/spring"? Interesting, what makes you think that "null path request gets shunted through the StaticResourceServlet"

Where is "__resource-servlet" defined, I can't see it in the web.xml so I don't know how it's mapped the request to it? I think I'm missing something, want to get this straight before I try and recreate it myself.

Also, how were these bundles deployed, Pickup, Admin Console or through the tooling?

Chris.


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.

[Updated on: Tue, 13 March 2012 17:00]

Report message to a moderator

Re: Snaps-based app doesn't allow welcome files? [message #820070 is a reply to message #820045] Tue, 13 March 2012 17:29 Go to previous message
Jason Levine is currently offline Jason LevineFriend
Messages: 12
Registered: July 2009
Junior Member
The web.xml for the host (again minus the root element, because the forum sees the URLs in it and won't let me post links):

<?xml version="1.0" encoding="UTF-8"?>
	<display-name>Virgo Web Portal</display-name>

	<filter>
		<filter-name>host-filter</filter-name>
		<filter-class>org.eclipse.virgo.snaps.core.SnapHostFilter</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>host-filter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>


The host is configured at Web-ContextPath '/lm'.

I'm not sure what you mean by "What is the full context path you are requesting as for just '/lm/spring'?". Guessing, the context should be to my Snap bundle -- called lmportal-spring, and residing in the lmportal-spring.jar file that you see in that log. That bundle's MANIFEST.MF has "Snap-ContextPath: /spring", mapping it to the full context '/lm/spring'.

__resource-servlet comes from Snap's own default web.xml -- in org.eclipse.virgo.snaps.core, in the src/main/resources/META-INF/snaps/default-web.xml file. It maps to Virgo's own StaticResourceServlet (org.eclipse.virgo.snaps.core.internal.webapp.StaticResourceServlet).

These bundles are all deployed via uploading them in the Admin Console.

I believe that Tomcat natively is supposed to handle welcome-file negotiation, so something's happening in Snaps to override this. (It's all spelled out in the Servlet spec, section 9.10 in Servlet 2.4.) Just looking at the log file I posted originally, I suspect that the problem here is that the default configuration for the Snaps host (as spelled out in that default-web.xml, etc.) is claiming control over the root ('/') of all deployed Snaps, rather than allowing Tomcat to try to do its welcome-file dance first.
Previous Topic:**RFC: Supporting PDE/Equinox bundles in Eclipse IDE
Next Topic:Adding a custom command via gogo in Virgo 3
Goto Forum:
  


Current Time: Thu Apr 18 23:12:05 GMT 2024

Powered by FUDForum. Page generated in 0.02221 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top