1

これがweb.xmlの私の設定です

<context-param>
        <param-name>
            org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
        <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
    </listener>

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

struts.xml

<package name="default" extends="struts-default, tiles-default">
    <action name="home" class="controller.HomeController">
        <result name="success" type="tiles">home</result>
    </action>
</package>

tiles.xml

<definition name="home" template="/layout.jsp">
    <put-attribute name="body" value="/WEB-INF/pages/home.jsp"/>
</definition>

pom.xmlで

<dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
        <version>2.2.1</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.struts.xwork</groupId>
        <artifactId>xwork-core</artifactId>
        <version>2.2.1</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-core</artifactId>
        <version>2.2.2</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-jsp</artifactId>
        <version>2.2.2</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-spring-plugin</artifactId>
        <version>2.2.1</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-extras</artifactId>
        <version>2.2.2</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>

完全なスタックトレースは次のとおりです。

SEVERE: Error configuring application listener of class org.apache.struts2.tiles.StrutsTilesListener
java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4537)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5097)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5092)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
4

2 に答える 2

1

クラスパスにstruts2 -tiles-plugin-2.2.x.jarがありません。依存関係があります:

<dependency>
  <groupId>org.apache.struts</groupId>
  <artifactId>struts2-tiles-plugin</artifactId>
  <version>${version.tiles}</version>
  <scope>compile</scope>
</dependency>

あなたはfindJARhttp ://www.findjar.com/index.x?query=org.apache.struts2.tiles.StrutsTilesListenerでClassNotFoundExceptionを解決することができます

于 2011-05-16T04:40:27.740 に答える
0

私はあなたがstruts2-tiles-pluginを逃していると思います

于 2011-05-16T04:40:23.493 に答える