我正在尝试使用带有 apache 磁贴的 spring mvc 的 helloworld 应用程序。当我部署我的应用程序时,tomcat 无法部署我的应用程序并显示以下错误:
SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/apache/tiles/TilesApplicationContext
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:606)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:518)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:504)
我使用了tiles 3.0并在tiles.xml配置文件中添加了tiles-config3.0。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
pom.xml
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>3.0.0</version>
</dependency>
你能告诉我我在这里缺少什么吗? 您的建议将不胜感激。 :)
最佳答案
也尝试添加这些依赖项。
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-template</artifactId>
<version>3.0.0</version>
</dependency>
如果没有解决请尝试<scope>runtime</scope>
为您tiles
pom.xml
中的依赖项
关于java - NoClassDefFound错误: org/apache/tiles/TilesApplicationContext Error with Spring Servlet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37084756/