当前位置: 动力学知识库 > 问答 > 编程问答 >

maven - Error when enabling Tiles with Struts2 Tiles plugin

问题描述:

I get this error when I try to deploy Struts2 application with Tiles on Tomcat:

Error configuring application listener of class org.apache.struts2.tiles.StrutsTilesListener

java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener

Here is pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>Nebula</groupId>

<artifactId>Nebula</artifactId>

<version>0.0.1-SNAPSHOT</version>

<packaging>war</packaging>

<name>Nebula</name>

<dependencies>

<dependency>

<groupId>org.apache.struts</groupId>

<artifactId>struts2-core</artifactId>

<version>2.3.8</version>

</dependency>

<dependency>

<groupId>org.apache.struts</groupId>

<artifactId>struts2-tiles-plugin</artifactId>

<version>2.3.8</version>

</dependency>

<dependency>

<groupId>javax.persistence</groupId>

<artifactId>persistence-api</artifactId>

<version>1.0.2</version>

</dependency>

<dependency>

<groupId>org.hibernate</groupId>

<artifactId>hibernate-core</artifactId>

<version>4.1.9.Final</version>

</dependency>

<dependency>

<groupId>postgresql</groupId>

<artifactId>postgresql</artifactId>

<version>9.1-901.jdbc4</version>

</dependency>

</dependencies>

<build>

<sourceDirectory>src</sourceDirectory>

<resources>

<resource>

<directory>src</directory>

<excludes>

<exclude>**/*.java</exclude>

</excludes>

</resource>

</resources>

<plugins>

<plugin>

<artifactId>maven-compiler-plugin</artifactId>

<version>2.3.2</version>

<configuration>

<source>1.7</source>

<target>1.7</target>

</configuration>

</plugin>

</plugins>

</build>

</project>

And web.xml:

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

<display-name>Nebula</display-name>

<context-param>

<param-name>org.apache.tiles.definition.DefinitionsFactory.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.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

</filter>

<filter-mapping>

<filter-name>struts2</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

</web-app>

This happened after I switched to Maven - before, when managing all JARs myself this wans't a problem.

I can see that the class org.apache.struts2.tiles.StrutsTilesListener does exists.

网友答案:

I created a new project from scratch and... it worked. Don't know what was the issue with the previous one.

分享给朋友:
您可能感兴趣的文章:
随机阅读: