|
#1
|
|||
|
|||
|
Hi !
I had problem with Tiles 2.1.0, thus I upgraded to the version 2.1.1... Unfortunately, this version is not compatible anymore with the Spring 2.5.6 TilesConfigurer class. The stack trace I got starting my Web Application is the following : Code:
java.lang.UnsupportedOperationException: Class org.apache.tiles.web.util.ServletContextAdapter not recognized a TilesApplicationContext at org.apache.tiles.factory.TilesContainerFactory.createContainer(TilesContainerFactory.java:219) at org.springframework.web.servlet.view.tiles2.TilesConfigurer.createTilesContainer(TilesConfigurer.java:214) at org.springframework.web.servlet.view.tiles2.TilesConfigurer.afterPropertiesSet(TilesConfigurer.java:201) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126) at javax.servlet.GenericServlet.init(GenericServlet.java:69) at com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:646) at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:587) at com.caucho.server.dispatch.ServletManager.init(ServletManager.java:154) at com.caucho.server.webapp.Application.start(Application.java:1654) at com.caucho.server.deploy.DeployController.startImpl(DeployController.java:621) at com.caucho.server.deploy.DeployController.restartImpl(DeployController.java:584) at com.caucho.server.deploy.StartAutoRedeployAutoStrategy.request(StartAutoRedeployAutoStrategy.java:125) at com.caucho.server.deploy.DeployController.request(DeployController.java:554) at com.caucho.server.webapp.ApplicationContainer.getApplication(ApplicationContainer.java:885) at com.caucho.server.webapp.ApplicationContainer.buildInvocation(ApplicationContainer.java:725) at com.caucho.server.host.Host.buildInvocation(Host.java:459) at com.caucho.server.host.HostContainer.buildInvocation(HostContainer.java:353) at com.caucho.server.resin.ServletServer.buildInvocation(ServletServer.java:653) at com.caucho.server.dispatch.DispatchServer.buildInvocation(DispatchServer.java:198) at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:415) at com.caucho.server.port.TcpConnection.run(TcpConnection.java:514) at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:520) at com.caucho.util.ThreadPool.run(ThreadPool.java:442) at java.lang.Thread.run(Thread.java:619) ![]() Regards, Simon |
|
#2
|
|||
|
|||
|
Yes same problem. I am using MVC 2.5.6 and Apache tiles 2.1.1 (I was using 2.0.6 previously) . I get the a ClassNotFound Exception: ServletTilesContextFactory etc..... When I tried to include this new updated version.
This is because the TlesConfigurer class is using SEVERAL deprecated parameters for the servlet initialization. for example: public TilesConfigurer() { this.tilesPropertyMap.put( TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM ,//deprecated TilesContainerFactory.class.getName()); this.tilesPropertyMap.put( TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM,//deprecated ChainedTilesContextFactory.class.getName()); this.tilesPropertyMap.put( TilesContainerFactory.DEFINITIONS_FACTORY_INIT_PAR AM, UrlDefinitionsFactory.class.getName()); this.tilesPropertyMap.put( TilesContainerFactory.PREPARER_FACTORY_INIT_PARAM, BasicPreparerFactory.class.getName()); this.tilesPropertyMap.put( ChainedTilesContextFactory.FACTORY_CLASS_NAMES, ServletTilesContextFactory.class.getName() + "," + JspTilesContextFactory.class.getName());//deprecated. ServletTilesContextFactory and JspTilesContextFactory are not even included in the 2.1 version this.tilesPropertyMap.put( UrlDefinitionsFactory.LOCALE_RESOLVER_IMPL_PROPERT Y, SpringLocaleResolver.class.getName()); } protected TilesContainer createTilesContainer(ServletContext context) throws TilesException { ServletContextAdapter adaptedContext = new ServletContextAdapter(new DelegatingServletConfig());//deprecated ServletContextAdapter is not in the 2.1 version TilesContainerFactory factory = TilesContainerFactory.getFactory(adaptedContext); return factory.createContainer(adaptedContext); } Any Ideas on how to reconfigure the TilesConfigurer for the 2.1 Apache tiles version. Any help would be appreciated by the community. There is nothing in google explaining this deprecation change!!! Thankx |
|
#3
|
|||
|
|||
|
Yes and I am using spring MVC 2.5.6 and Apache tiles 2.1.1 (I was using 2.0.6 previously) . I get the a ClassNotFound Exception: ServletTilesContextFactory etc..... When I tried to include this new updated version.
This is because the TlesConfigurer class is using SEVERAL deprecated parameters for the servlet initialization. for example: public TilesConfigurer() { this.tilesPropertyMap.put( TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM ,//deprecated TilesContainerFactory.class.getName()); this.tilesPropertyMap.put( TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM,//deprecated ChainedTilesContextFactory.class.getName()); this.tilesPropertyMap.put( TilesContainerFactory.DEFINITIONS_FACTORY_INIT_PAR AM, UrlDefinitionsFactory.class.getName()); this.tilesPropertyMap.put( TilesContainerFactory.PREPARER_FACTORY_INIT_PARAM, BasicPreparerFactory.class.getName()); this.tilesPropertyMap.put( ChainedTilesContextFactory.FACTORY_CLASS_NAMES, ServletTilesContextFactory.class.getName() + "," + JspTilesContextFactory.class.getName());//deprecated. ServletTilesContextFactory and JspTilesContextFactory are not even included in the 2.1 version this.tilesPropertyMap.put( UrlDefinitionsFactory.LOCALE_RESOLVER_IMPL_PROPERT Y, SpringLocaleResolver.class.getName()); } protected TilesContainer createTilesContainer(ServletContext context) throws TilesException { ServletContextAdapter adaptedContext = new ServletContextAdapter(new DelegatingServletConfig());//deprecated ServletContextAdapter is not in the 2.1 version TilesContainerFactory factory = TilesContainerFactory.getFactory(adaptedContext); return factory.createContainer(adaptedContext); } Any Ideas on how to reconfigure the TilesConfigurer for the 2.1 Apache tiles version. Any help would be appreciated by the community. There is nothing in google explaining this deprecation change!!! Thankx |
|
#4
|
|||
|
|||
|
Created a JIRA issue : http://jira.springframework.org/browse/SPR-5411
|
|
#5
|
|||
|
|||
|
Hi,
in case someone needs quick fix for the issue: HTML Code:
<bean id="tilesConfigurer" class="com.epam.samples.tss.tiles2.TilesConfigurer"> <property name="definitions" value="/WEB-INF/tss-tiles.xml"/> <property name="definitionsFactoryClass" value="org.apache.tiles.definition.UrlDefinitionsFactory"/> <property name="preparerFactoryClass" value="com.epam.samples.tss.tiles2.SpringBeanPreparerFactory"/> </bean> Slava |
|
#6
|
|||
|
|||
|
This is another example of creating the TilesContainer from the TilesConfigurer. It comes directly from the org.apache.tiles.web.startup.TilesListener class.
Code:
protected TilesContainer createTilesContainer(ServletContext context) throws TilesException {
TilesApplicationContext applicationContext =
new ServletTilesApplicationContext(new ServletContextAdapter(new DelegatingServletConfig()));
AbstractTilesApplicationContextFactory acFactory = AbstractTilesApplicationContextFactory.createFactory(applicationContext);
if (acFactory instanceof Initializable) {
((Initializable) acFactory).init(applicationContext.getInitParams());
}
applicationContext = acFactory.createApplicationContext(context);
AbstractTilesContainerFactory factory = AbstractTilesContainerFactory.getTilesContainerFactory(applicationContext);
return factory.createContainer(applicationContext);
}
|
|
#7
|
|||
|
|||
|
Quote:
HTML Code:
java.lang.IllegalArgumentException: Cannot find a factory to create the request context at org.apache.tiles.context.ChainedTilesRequestContextFactory.createRequestContext(ChainedTilesRequestContextFactory.java:141) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:318) at com.anydoby.tiles2.spring.VelocityTiles2View.doRender(VelocityTiles2View.java:27) at org.springframework.web.servlet.view.velocity.VelocityView.renderMergedTemplateModel(VelocityView.java:320) at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:174) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:258) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1174) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source) spydesk, which version of Tiles are you using in your application? I tried to run it with 2.0.1, 2.1.1 and 2.1.2 without any success ![]() Thanks a lot in advance! |
|
#8
|
|||
|
|||
|
Quote:
I would suggest you to test without Preparer class nor any Factory class : Code:
<bean id="tilesConfigurer" class="com.epam.samples.tss.tiles2.TilesConfigurer"/> |
|
#9
|
|||
|
|||
|
Quote:
![]() unfortunately it's not possible to get apache tiles 2.1.1 at the moment from the official site. have you tried to run it with 2.1.2? I tried to run it without the factory defined in spring xml and have got the same trouble
|
|
#10
|
|||
|
|||
|
I have not tried the 2.1.2 version yet...
I have to admit that I tested Tiles only with the help of the Tiles Tag Library in JSP Files and without any XML definitions (tiles-defs.xml). That differ a lot with your configuration where you seem to load XML Tiles definitions from a tiles-defs.xml file and render the view with the help of Velocity... |
![]() |
| Thread Tools | |
| Display Modes | |
|
|