Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring 3 MVC and Apache Tiles 2 Integration Error

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.

like image 980
Athens Holloway Avatar asked Feb 15 '11 13:02

Athens Holloway


1 Answers

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>
like image 98
damian Avatar answered Sep 20 '22 14:09

damian