Spring 3 MVC and Apache Tiles 2 Integration Error

ε祈祈猫儿з 提交于 2019-11-30 17:36:33

org.apache.tiles.startup.BasicTilesInitializer is a class of tiles-core(2.2.1).jar. Check that you have deployed the tiles-core jar

iowatiger08

For tiles 3, use class org.springframework.web.servlet.view.tiles3.TilesConfigurer. Make sure you have that in spring webmvc.

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>  

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.

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.

I could only solve this after I added dependency to be provided at compile time in my POM

<scope>compile</scope>

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>

Check if the following jars are on the application class-path:

  1. commons-beanutils
  2. commons-digester
  3. log4j
  4. slf4j-api
  5. slf4j-log4j12
  6. tiles-api
  7. tiles-core
  8. tiles-jsp
  9. tiles-servlet
  10. tiles-template

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.

Lokanad

For tiles 3, you should add

tiles-request.jar, commons-digester.jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!