strutstileslistener在struts 2 tiles程序中找不到

问题描述 投票:0回答:2

我无法找到我的申请有什么问题。使用支柱2和瓷砖。 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_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>strutsForScoodle</display-name>

<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.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>

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

<welcome-file-list>
  <welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>

Tiles.xml:

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

<!DOCTYPE tiles-definitions PUBLIC
   "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
   "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>
<definition name="baseLayout" template="/WEB-INF/content/tiles/BaseLayout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="/WEB-INF/content/tiles/Header.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="/WEB-INF/content/tiles/Footer.jsp" />
</definition>
<definition name="logoff.tiles" extends="baseLayout">
<put-attribute name="title" value="Logoff" />
<put-attribute name="body" value="/WEB-INF/content/tiles/logoff.jsp" />
</definition>
<definition name="createSurvey.tiles" extends="baseLayout">
<put-attribute name="title" value="create Survey" />
<put-attribute name="body" value="/WEB-INF/content/tiles/createSurvey.jsp" />
</definition>
</tiles-definitions>

struts.xml中:

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

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

<package name="default" extends="struts-default">
  <result-types>
     <result-type name="tiles" 
     class="org.apache.struts2.views.tiles.TilesResult" />
  </result-types>

  <action name="*Navigate" method="{1}" 
     class="de.umfragetool.action.NavigateAction">
     <result name="overview" type="tiles">overview</result>
     <result name="logoff" type="tiles">logoff</result>
     <result name="createSurvey" type="tiles">createSurvey</result>
  </action>

  </package>
 </struts>

maven的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>Struts4Scoodle</groupId>
<artifactId>Struts4Scoodle</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Scoodle</name>
<description>Scoodle Tool</description>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
      <source>1.7</source>
      <target>1.7</target>
    </configuration>
  </plugin>
  <plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
    <configuration>
      <warSourceDirectory>WebContent</warSourceDirectory>
      <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
  </plugin>
 </plugins>
  </build>
 <dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
                    <!--        struts -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.15.2</version>
</dependency>

<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>2.3.15.2</version>
</dependency>
<!--                            tiles -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
<version>2.3.15.2</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>3.0.1</version>
</dependency>

<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>3.0.1</version>
</dependency>

<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-compat</artifactId>
<version>3.0.1</version>
</dependency>

</dependencies>
</project>

所有这些我得到了这个失败:

`Okt 17,2013 8:34:41 PM org.apache.catalina.core.AprLifecycleListener init信息:在java.library.path上找不到基于APR的Apache Tomcat Native库,它允许在生产环境中获得最佳性能:C: \ Program Files \ Java \ jre7 \ bin; C:\ Windows \ Sun \ Java \ bin; C:\ Windows \ system32; C:\ Windows; C:\ Windows \ system32; C:\ Windows; C:\ Windows \ System32 \ Wbem; C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \; C:\ Program Files(x86)\ MiKTeX 2.9 \ miktex \ bin \; C:\ Program Files \ Java \ jdk1.7.0_40; C: \ Apache的行家-3.1.1斌\ Apache的行家-3.1.1 \ BIN ;. Okt 17,2013 8:34:41 PM org.apache.tomcat.util.digester.SetPropertiesRule begin Warnung:[SetPropertiesRule] {Server / Service / Engine / Host / Context}将属性'source'设置为'org.eclipse.jst .jee.server:Struts4Scoodle'找不到匹配的属性。 Okt 17,2013 8:34:41 PM org.apache.coyote.AbstractProtocolHandler init信息:初始化ProtocolHandler [“http-bio-8080”] Okt 17,2013 8:34:41 PM org.apache.coyote.AbstractProtocolHandler init Information :初始化ProtocolHandler [“ajp-bio-8009”] Okt 17,2013 8:34:41 PM org.apache.catalina.startup.Catalina load信息:初始化处理时间为561 ms Okt 17,2013 8:34:41 PM org .apache.catalina.core.StandardService startInternal信息:启动服务Catalina Okt 17,2013 8:34:41 PM org.apache.catalina.core.StandardEngine startInternal Information:启动Servlet引擎:Apache Tomcat / 7.0.12 Okt 17,2013 8:34:42 PM org.apache.catalina.core.StandardContext listenerStart Schwerwiegend:配置类org.apache.struts2.tiles.StrutsTilesListener的应用程序监听器时出错java.lang.NoClassDefFoundError:org / apache / tiles / web / startup / TilesListener at java.lang.ClassLoader.defineClass1(Native Method)at java.lang.ClassLoader.defineClass(Unknown Source)at at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)中的java.security.SecureClassLoader.defineClass(未知来源)位于org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1148)at at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)org.apache.catalina.core.DefaultInstanceManager.loadClass( DefaultInstanceManager.java:415)org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)org.apache.catalina .core.StandardContext.listenerStart(StandardContext.java:4638)org.apache.catalina.core.StandardContext $ 1.call(StandardContext.java:5204)at org.apache.catalina.core.StandardContext $ 1.call(StandardContext.java) :5199)at java.util.concurrent.FutureTask.run(Unkn在爪哇java.util.concurrent.ThreadPoolExecutor.runWorker(未知来源)java.util.ThreadPoolExecutor java.lang.Thread.run上的$ Worker.run(未知来源)(未知来源)引起:java。 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java)中的lang.ClassNotFoundException:org.apache.tiles.web.startup.TilesListener :1521)......还有17个

Okt 17,2013 8:34:42 PM org.apache.catalina.core.StandardContext listenerStart Schwerwiegend:由于之前的错误而跳过安装应用程序监听器Okt 17,2013 8:34:42 PM org.apache.catalina.core .StandardContext startInternal Schwerwiegend:Error listenerStart Okt 17,2013 8:34:42 PM org.apache.catalina.core.StandardContext startInternal Schwerwiegend:Context [/ Struts4Scoodle]启动因先前的错误而失败Okt 17,2007 8:34:42 PM org.apache.coyote.AbstractProtocolHandler start信息:启动ProtocolHandler [“http-bio-8080”] Okt 17,2013 8:34:42 PM org.apache.coyote.AbstractProtocolHandler start信息:启动ProtocolHandler [“ajp-bio-8009 “] Okt 17,2013 8:34:42 PM org.apache.catalina.startup.Catalina start信息:服务器启动时间为739毫秒

这是我第一次使用Tiles而且我没有得到它。非常感谢你。

java struts2 tiles
2个回答
0
投票
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>3.0.1</version>
</dependency>

<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>3.0.1</version>
</dependency>

删除以上依赖项。 struts2-tiles-plugin将自动传递tile依赖项,并且版本为2. *而不是3. *


0
投票

导入库jsp-api-2.1,因为struts2-tiles-plugin依赖于它

© www.soinside.com 2019 - 2024. All rights reserved.