Community   SpringSource   Projects    Downloads    Documentation    Forums    Training   Exchange   Blogs

Go Back   Spring Community Forums > Core Spring Projects > Web

Reply
 
Thread Tools Display Modes
  #1  
Old Jan 13th, 2009, 07:29 AM
spydesk spydesk is offline
Junior Member
 
Join Date: Nov 2008
Posts: 10
Default TilesConfigurer class no longer works with Tiles 2.1.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)
Any fix version planned already ?

Regards,

Simon
Reply With Quote
  #2  
Old Jan 13th, 2009, 07:42 AM
amonter5 amonter5 is offline
Junior Member
 
Join Date: Jan 2009
Posts: 3
Default What I know is that TilesConfigurer is completely deprecated.

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
Reply With Quote
  #3  
Old Jan 13th, 2009, 07:47 AM
amonter5 amonter5 is offline
Junior Member
 
Join Date: Jan 2009
Posts: 3
Default Yes it's not working at all!

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
Reply With Quote
  #4  
Old Jan 14th, 2009, 10:46 AM
spydesk spydesk is offline
Junior Member
 
Join Date: Nov 2008
Posts: 10
Default

Created a JIRA issue : http://jira.springframework.org/browse/SPR-5411
Reply With Quote
  #5  
Old Jan 15th, 2009, 01:33 AM
Slava Kudinov Slava Kudinov is offline
Junior Member
 
Join Date: Jan 2009
Location: Belarus
Posts: 1
Default Quick fix for the issue

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>
Best Regards
Slava
Attached Files
File Type: zip spring_2.5.6+tiles_2.1.1.zip (3.9 KB, 218 views)
Reply With Quote
  #6  
Old Jan 15th, 2009, 04:33 AM
spydesk spydesk is offline
Junior Member
 
Join Date: Nov 2008
Posts: 10
Post

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);
}
Reply With Quote
  #7  
Old Feb 11th, 2009, 05:01 AM
polosatij polosatij is offline
Junior Member
 
Join Date: Feb 2009
Posts: 3
Unhappy java.lang.IllegalArgumentException

Quote:
Originally Posted by Slava Kudinov View Post
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>
Best Regards
Slava
Unfortunately, your example didn't work anymore. I tried today to run in with tilel 2.1.1 and I get following error:

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)
can anybody provide more information to this solution?

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!
Reply With Quote
  #8  
Old Feb 11th, 2009, 07:04 AM
spydesk spydesk is offline
Junior Member
 
Join Date: Nov 2008
Posts: 10
Default

Quote:
spydesk, which version of Tiles are you using in your application?
It was tiles-2.1.1 in conjunction with spring-2.5.6.

I would suggest you to test without Preparer class nor any Factory class :

Code:
<bean id="tilesConfigurer" class="com.epam.samples.tss.tiles2.TilesConfigurer"/>
Reply With Quote
  #9  
Old Feb 11th, 2009, 07:56 AM
polosatij polosatij is offline
Junior Member
 
Join Date: Feb 2009
Posts: 3
Unhappy 2.1.2?

Quote:
Originally Posted by spydesk View Post
It was tiles-2.1.1 in conjunction with spring-2.5.6.

I would suggest you to test without Preparer class nor any Factory class :

Code:
<bean id="tilesConfigurer" class="com.epam.samples.tss.tiles2.TilesConfigurer"/>
thanks a lot for your response!

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
Reply With Quote
  #10  
Old Feb 11th, 2009, 09:18 AM
spydesk spydesk is offline
Junior Member
 
Join Date: Nov 2008
Posts: 10
Default

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...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:44 AM.


Contegix provides first-class managed hosting and partial sponsorship of these forums.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.