aspose file tools*
The moose likes Spring and the fly likes Tiles 2.1 integration with Spring 3.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Tiles 2.1 integration with Spring 3.0" Watch "Tiles 2.1 integration with Spring 3.0" New topic
Author

Tiles 2.1 integration with Spring 3.0

Arshia Bora
Greenhorn

Joined: Jan 08, 2010
Posts: 7
Hello,
I am trying to integrate Spring 3.0 with Tiles 2.1.4 in my application. But when tomcat server is started the autowiring is failing with bean being not created. There were some Spring issues in past for Spring 2.5 & Tiles 2.1 integration, which were supposed to be addressed in Spring 3.0. But I still see this problem. Can someone provide me any help from the stacktrace below? Thanks in advance.

ERROR [main] (FrameworkServlet.java:315) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in ServletContext resource [/WEB-INF/systemmonitor-servlet.xml]: Invocation of init method failed; nested exception is org.apache.tiles.portlet.context.NotAPortletEnvironmentException: Cannot access portlet classes
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1401)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.apache.tiles.portlet.context.NotAPortletEnvironmentException: Cannot access portlet classes
at org.apache.tiles.portlet.context.PortletTilesRequestContextFactory.<init>(PortletTilesRequestContextFactory.java:71)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.tiles.context.ChainedTilesRequestContextFactory.init(ChainedTilesRequestContextFactory.java:100)
at org.apache.tiles.factory.TilesContainerFactory.storeContainerDependencies(TilesContainerFactory.java:429)
at org.apache.tiles.factory.TilesContainerFactory.initializeContainer(TilesContainerFactory.java:368)
at org.apache.tiles.factory.TilesContainerFactory.createTilesContainer(TilesContainerFactory.java:287)
at org.apache.tiles.factory.TilesContainerFactory.createContainer(TilesContainerFactory.java:231)
at org.apache.tiles.startup.BasicTilesInitializer.createContainer(BasicTilesInitializer.java:117)
at org.apache.tiles.startup.BasicTilesInitializer.initialize(BasicTilesInitializer.java:53)
at org.springframework.web.servlet.view.tiles2.TilesConfigurer.afterPropertiesSet(TilesConfigurer.java:203)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
... 41 more
Caused by: java.lang.NoClassDefFoundError: javax/portlet/PortletRequest
at org.apache.tiles.portlet.context.PortletTilesRequestContextFactory.<init>(PortletTilesRequestContextFactory.java:66)
... 57 more
Caused by: java.lang.ClassNotFoundException: javax.portlet.PortletRequest
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 58 more
Jan 20, 2010 6:56:03 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
Kishore Tulsiani
Greenhorn

Joined: Jan 15, 2010
Posts: 21
Can you post your spring and tiles config file..

what i have done is i have given this referance in spring config and using the below view resolvers



property file for the views is in com.controller folder . this might help you
Arshia Bora
Greenhorn

Joined: Jan 08, 2010
Posts: 7
It is a web-mvc application. I have pasted the XML contents below. It is same as yours.

<bean id="viewResolver1" class="org.springframework.web.servlet.view.Resour ceBundleViewResolver" p:basename="views" />
<context:component-scan base-package="com.sample.web" />
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2 .TilesConfigurer" p:definitions="/WEB-INF/tiles-defs.xml" />

tiles-defs.xml contents is given below.
---------------------------------------------

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>

<definition name="baseLayout" template="/WEB-INF/tiles/baseLayout.jsp">
<put-attribute name="title" value="Template"/>
<put-attribute name="header" value="/WEB-INF/tiles/header.jsp"/>
<put-attribute name="menu" value="/WEB-INF/tiles/menu.jsp"/>
<put-attribute name="body" value="/WEB-INF/tiles/body.jsp"/>
<put-attribute name="footer" value="/WEB-INF/tiles/footer.jsp"/>
</definition>

<definition name="welcome" extends="baseLayout">
<put-attribute name="title" value="Welcome"/>
<put-attribute name="body" value="/WEB-INF/jsp/welcome.jsp"/>
</definition>

<definition name="friends" extends="baseLayout">
<put-attribute name="title" value="Friends"/>
<put-attribute name="body" value="/WEB-INF/jsp/friends.jsp"/>
</definition>

<definition name="office" extends="baseLayout">
<put-attribute name="title" value="Office"/>
<put-attribute name="body" value="/WEB-INF/jsp/office.jsp"/>
</definition>

</tiles-definitions>
Arshia Bora
Greenhorn

Joined: Jan 08, 2010
Posts: 7
This issue is resolved now after downloading the dependendend files. Hopefully we will soon have Spring 3.0 with depedant available for development. If anyone already know please share the link.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Arshia Bora wrote:This issue is resolved now after downloading the dependendend files. Hopefully we will soon have Spring 3.0 with depedant available for development. If anyone already know please share the link.


Note that in Spring 3.0 all jars are now separate, there is no more spring-all.jar

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Arshia Bora
Greenhorn

Joined: Jan 08, 2010
Posts: 7
Hey Mark,
The way we had "spring-framework-2.5.5-with-dependencies", are we not going to have "spring-framework-3.0-with-dependencies" available soon?
reza ghaffaripour
Greenhorn

Joined: May 08, 2008
Posts: 3
So what is the dependency here? I can not figure out and still get the error...

Thanks,
Reza
Arshia Bora
Greenhorn

Joined: Jan 08, 2010
Posts: 7
You need to keep resolving the exceptions by including other librariers from Spring 3.0 for e.g. Portlet stuff. Once that is fixed, you might need commons-digester1.8.jar, commons-logging-api.jar etc. So basically go on fixing the dependencies one by one. Make sure that you download correct dependancy (& remember the same from where you downloaded this; this will help to resolve Deployment issues if any).
 
 
subject: Tiles 2.1 integration with Spring 3.0