virgo 2.1, snaps and tiles 2 [message #665044] |
Wed, 13 April 2011 03:25 |
Jan Fetyko Messages: 28 Registered: April 2011 |
Junior Member |
|
|
I have snaps installed into virgo 2.1 and have a web root and a snap. Both of them use tiles 2. The problem is that the tiles in root work fine as long as the snap is not deployed. Once I deploy the snap, the tiles somehow looses the tiles container. I get this error:
Tiles container is not initialized. Have you added a TilesConfigurer to your web application context?
Tiles are being configured together with spring 3.0.5.
Is there anything in virgo that would cause this ?
Does anybody has experience doing this and getting it working ?
Please advice.
Thank you.
Jan
[Updated on: Wed, 13 April 2011 03:27] Report message to a moderator
|
|
|
|
|
|
Re: virgo 2.1, snaps and tiles 2 [message #665234 is a reply to message #665216] |
Wed, 13 April 2011 19:51 |
Jan Fetyko Messages: 28 Registered: April 2011 |
Junior Member |
|
|
Dmitry,
I discovered that the Tiles container vanishes only if I redeploy the snap, which is annoying but perhaps less severe. Before I create a simplified example which will take me little bit of time, I decided to post some other configurations:
web.xml from root
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml /WEB-INF/spring/root-osgi-context.xml</param-value>
</context-param>
<context-param>
<param-name>contextClass</param-name>
<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- SPANS HOST FILTER -->
<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>
</filter-mapping>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<init-param>
<param-name>contextClass</param-name>
<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Disables Servlet Container welcome file handling. Needed for compatibility with Servlet 3.0 and Tomcat 7.0 -->
<welcome-file-list>
<welcome-file></welcome-file>
</welcome-file-list>
</web-app>
servlet context xml for root
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<mvc:annotation-driven conversion-service="conversionService" />
<!-- TODO - will restore namespace tag once its been brought up to date - using full bean definitions for now -->
<bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter" />
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/resources/**">resourceHandler</prop>
<prop key="/*">fileNameViewController</prop>
</props>
</property>
</bean>
<bean id="resourceHandler" class="org.springframework.web.servlet.resource.ResourceHttpRequestHandler">
<property name="locations">
<list>
<value>/resources/*</value>
</list>
</property>
</bean>
<!-- END TODO -->
<!-- imports user-defined @Controller beans that process client requests -->
<import resource="controllers.xml" />
<!-- Only needed because we install custom converters to support the examples in the org.springframewok.samples.mvc.convert package -->
<bean id="conversionService" class="com.dummy.convert.CustomConversionServiceFactoryBean" />
<!-- bootstrap the JSR 303 bean validators -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />
<!-- a reloadable message source that should contain all text messages, labels, and errors -->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>/WEB-INF/i18n/messages</value>
<value>/WEB-INF/i18n/formMessages</value>
<value>/WEB-INF/i18n/validationMessages</value>
</list>
</property>
<property name="useCodeAsDefaultMessage" value="true" />
</bean>
<!-- setup the Tiles configurer -->
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-defs/tiles-defs.xml</value>
<value>/WEB-INF/tiles-defs/security-defs.xml</value>
</list>
</property>
</bean>
<!-- setup the view resolver for Tiles and all AJAX based requests -->
<bean id="tilesViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedViewResolver">
<property name="viewClass" value="com.cme.star.mvc.js.ajax.tiles2.AjaxTilesView"/>
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!-- a simple controller that handles all url's simplifying their names (e.g. "/home.htm" => "home", "/user/list.htm" => "user/list", etc.) -->
<bean id="fileNameViewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
</beans>
the servlet context xml for the snap is the same, just has different tiles definitions.
Notes:
* It is strange to me that when I see the logs or exceptions in the snap, I don't see a stack trace that includes the spring dispatcher servlet. For example I receive this error when trying to access a controller in the snap:
java.io.FileNotFoundException: C:\virgo\web\work\osgi\configuration\org.eclipse.osgi\bundles\36\data\store\org.eclipse.osgi\bundles\99\2\bundlefile\ (The system cannot find the path specified)
java.io.FileInputStream.open(Native Method)
java.io.FileInputStream.<init>(FileInputStream.java:106)
org.eclipse.osgi.framework.util.SecureAction.getFileInputStream(SecureAction.java:123)
org.eclipse.osgi.baseadaptor.bundlefile.FileBundleEntry.getInputStream(FileBundleEntry.java:56)
org.eclipse.osgi.framework.internal.core.BundleURLConnection.connect(BundleURLConnection.java:53)
org.eclipse.osgi.framework.internal.core.BundleURLConnection.getInputStream(BundleURLConnection.java:99)
java.net.URL.openStream(URL.java:1010)
org.eclipse.virgo.snaps.core.internal.webapp.StaticResourceServlet.doGet(StaticResourceServlet.java:62)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.eclipse.virgo.snaps.core.internal.webapp.container.ImmutableFilterChain.doFilter(ImmutableFilterChain.java:47)
org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher$1.doWithClassLoader(StandardVirtualContainerRequestDispatcher.java:104)
org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher$1.doWithClassLoader(StandardVirtualContainerRequestDispatcher.java:1)
org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher.doWithThreadContextClassLoader(StandardVirtualContainerRequestDispatcher.java:121)
org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher.service(StandardVirtualContainerRequestDispatcher.java:101)
org.eclipse.virgo.snaps.core.internal.webapp.WebAppSnap.handleRequest(WebAppSnap.java:153)
org.eclipse.virgo.snaps.core.RequestRouter.service(RequestRouter.java:51)
org.eclipse.virgo.snaps.core.SnapHostFilter.doFilter(SnapHostFilter.java:62)
BTW the above path does exists, so I'm not sure what is the problem, but as you can see, the Dispatcher servlet is not in the path, so how does this work ?
* Another behavior I experienced is that static content is available in the snap, so a text file for example is displayed just fine.
* Looks like now the problem evolved into tiles not working correctly in the snap which upon redeploy breaking the root's tiles.
I know I dumped a lot of info here, so I'm going to stop now and see if there is any advice you can give me.
In the mean time, I continue digging.
Thank you.
Jan
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04231 seconds