Reputation: 2203
I have been trying to integrate Spring (3.0.4 and 3.0.5) MVC with Apache Tiles (2.1.2,2.1.4 and 2.2.2) to no avail. In every case i get the following error:
java.lang.NoClassDefFoundError: org/apache/tiles/startup/BasicTilesInitializer
According to the Tiles documentation, BasicTilesInitializer has been deprecated. I figured the latest version of Spring's TilesConfigurer would reference the correct class, but it doesnt and I still get the same error.
I'm using the following configuration to setup Tiles in my spring mvc app:
<beans:bean
id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<beans:property name="definitions">
<beans:list>
<beans:value>/WEB-INF/tiles/tiles.xml</beans:value>
</beans:list>
</beans:property>
</beans:bean>
<beans:bean
class="org.springframework.web.servlet.view.tiles2.TilesViewResolver">
<beans:property
name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
</beans:bean>
Ideally, I would like to get Spring 3.0.5 working with Tiles 2.2.2. They are the latest versions as of this post.
Upvotes: 13
Views: 37331
Reputation: 1962
For tiles 3, use class org.springframework.web.servlet.view.tiles3.TilesConfigurer
. Make sure you have that in spring webmvc
.
Upvotes: 20
Reputation: 616
Check if the following jars are on the application class-path:
Version of tiles jars is depends on the version of Spring MVC. E.g. If Spring MVC 3.2.3 (org.springframework.web.servlet.view.tiles3.TilesConfigurer) is used then tile 3 jars are required.
Upvotes: 0
Reputation: 4054
I was having same problem, using version 2.2.2 of tiles. I switched to version 2.2.1 and it started to work. Here are my dependencies:
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>2.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-api</artifactId>
<version>2.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-template</artifactId>
<version>2.2.1</version>
</dependency>
Upvotes: 1
Reputation: 1
I could only solve this after I added dependency to be provided at compile time in my POM
<scope>compile</scope>
Upvotes: 0
Reputation: 939
I'm not going to apologize for reviving a stale thread.
I have a Spring MVC project built in Eclipse Helios.
I shut down Helios for a few days, then reopened it today. When I ran my app, I got the same exception as above: java.lang.NoClassDefFoundError: org/apache/tiles/startup/BasicTilesInitializer.
My solution was to clean the deploy directory on the integrated Tomcat server, then re-deploy the app. The first time I redeployed, my app's lib dir showed only two jars. So after cleaning and redeploying again, it then got all the necessary jar's and now my app runs again. Go figure.
Upvotes: 1
Reputation: 1277
If you are using maven then you can add this dependency in order to solve the problem:
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>2.2.2</version>
</dependency>
Upvotes: 8
Reputation: 3838
If you are using STS and you created your project using a spring template project (like the MVC one) then you don't add anything to the lib directory. Instead you modify the pom.xml maven config file.
Upvotes: 0
Reputation: 120861
org.apache.tiles.startup.BasicTilesInitializer
is a class of tiles-core(2.2.1).jar
. Check that you have deployed the tiles-core
jar
Upvotes: 12