【问题标题】:NoClassDefFoundError: org/apache/tiles/TilesApplicationContext Error with Spring ServletNoClassDefFoundError: org/apache/tiles/TilesApplicationContext 错误与 Spring Servlet
【发布时间】:2016-05-07 05:14:37
【问题描述】:

我正在尝试使用带有 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>

你能告诉我我在这里缺少什么吗? 您的建议将不胜感激。 :)

【问题讨论】:

  • 您的瓦片 jar 似乎没有与您的应用一起部署。
  • 我已经粘贴到WEB-INF/lib文件夹了。
  • 可能有点太晚了,但是 TilesApplicationContext 属于 Tiles 2,而不是 Tiles 3。你可能在某个地方有错误的依赖。也许您的观点之一是使用org.springframework.web.servlet.view.tiles2.TilesView 而不是org.springframework.web.servlet.view.tiles3.TilesView
  • Spring-webflow 2.4.x 中不正确的版本或其他版本的 Tiles 可能会干扰。需要检查并排除较旧的 TIles。 Spring-webflow 2.5.1 有 Tiles3。

标签: java apache maven spring-mvc tiles


【解决方案1】:

也尝试添加这些依赖项。

<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>

如果未解决,请尝试 &lt;scope&gt;runtime&lt;/scope&gt; 为您在 pom.xml 中的 tiles 依赖项

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-14
    • 2013-10-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-02
    • 2015-06-30
    • 2015-11-23
    • 2016-12-22
    相关资源
    最近更新 更多