File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

Tiles 2.1 integration with Spring 3.0

Arshia Bora

Joined: Jan 08, 2010
Posts: 7
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] ( - 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.web.servlet.FrameworkServlet.createWebApplicationContext(
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(
at org.springframework.web.servlet.FrameworkServlet.initServletBean(
at org.springframework.web.servlet.HttpServletBean.init(
at javax.servlet.GenericServlet.init(
at org.apache.catalina.core.StandardWrapper.loadServlet(
at org.apache.catalina.core.StandardWrapper.load(
at org.apache.catalina.core.StandardContext.loadOnStartup(
at org.apache.catalina.core.StandardContext.start(
at org.apache.catalina.core.ContainerBase.addChildInternal(
at org.apache.catalina.core.ContainerBase.addChild(
at org.apache.catalina.core.StandardHost.addChild(
at org.apache.catalina.startup.HostConfig.deployDescriptor(
at org.apache.catalina.startup.HostConfig.deployDescriptors(
at org.apache.catalina.startup.HostConfig.deployApps(
at org.apache.catalina.startup.HostConfig.start(
at org.apache.catalina.startup.HostConfig.lifecycleEvent(
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardHost.start(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardEngine.start(
at org.apache.catalina.core.StandardService.start(
at org.apache.catalina.core.StandardServer.start(
at org.apache.catalina.startup.Catalina.start(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.catalina.startup.Bootstrap.start(
at org.apache.catalina.startup.Bootstrap.main(
Caused by: org.apache.tiles.portlet.context.NotAPortletEnvironmentException: Cannot access portlet classes
at org.apache.tiles.portlet.context.PortletTilesRequestContextFactory.<init>(
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at java.lang.Class.newInstance0(
at java.lang.Class.newInstance(
at org.apache.tiles.context.ChainedTilesRequestContextFactory.init(
at org.apache.tiles.factory.TilesContainerFactory.storeContainerDependencies(
at org.apache.tiles.factory.TilesContainerFactory.initializeContainer(
at org.apache.tiles.factory.TilesContainerFactory.createTilesContainer(
at org.apache.tiles.factory.TilesContainerFactory.createContainer(
at org.apache.tiles.startup.BasicTilesInitializer.createContainer(
at org.apache.tiles.startup.BasicTilesInitializer.initialize(
at org.springframework.web.servlet.view.tiles2.TilesConfigurer.afterPropertiesSet(
... 41 more
Caused by: java.lang.NoClassDefFoundError: javax/portlet/PortletRequest
at org.apache.tiles.portlet.context.PortletTilesRequestContextFactory.<init>(
... 57 more
Caused by: java.lang.ClassNotFoundException: javax.portlet.PortletRequest
at org.apache.catalina.loader.WebappClassLoader.loadClass(
at org.apache.catalina.loader.WebappClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
... 58 more
Jan 20, 2010 6:56:03 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
Kishore Tulsiani

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

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"


<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 name="welcome" extends="baseLayout">
<put-attribute name="title" value="Welcome"/>
<put-attribute name="body" value="/WEB-INF/jsp/welcome.jsp"/>

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

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

Arshia Bora

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

Joined: Feb 05, 2001
Posts: 17276

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


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Arshia Bora

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

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

Arshia Bora

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).
I agree. Here's the link:
subject: Tiles 2.1 integration with Spring 3.0
It's not a secret anymore!