2

实际上,我正在尝试将 struts spring 和 hibernate 集成到在线考试系统中。在运行项目时,它会抛出以下错误

Http Status 404 - online Exam/registration.jsp

Description: The requested resource is not available.

在控制台中,出现以下内容,

INFO: TLD skipped. URI: /struts-tags is already defined
Sep 10, 2013 9:14:28 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Sep 10, 2013 9:14:28 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.apache.tiles.extras.complete.CompleteAutoloadTilesListener
java.lang.NoSuchMethodError: org.apache.tiles.startup.TilesInitializer.initialize(Lorg/apache/tiles/request/ApplicationContext;)V
    at org.apache.tiles.web.startup.AbstractTilesListener.contextInitialized(AbstractTilesListener.java:53)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:724)

Sep 10, 2013 9:14:28 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Sep 10, 2013 9:14:31 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Sep 10, 2013 9:14:31 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/iSAS] startup failed due to previous errors
Sep 10, 2013 9:14:31 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Sep 10, 2013 9:14:31 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.apache.tiles.extras.complete.CompleteAutoloadTilesListener
java.lang.NoSuchMethodError: org.apache.tiles.startup.TilesInitializer.destroy()V
    at org.apache.tiles.web.startup.AbstractTilesListener.contextDestroyed(AbstractTilesListener.java:63)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:724)

Sep 10, 2013 9:14:31 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/iSAS] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Sep 10, 2013 9:14:31 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
Sep 10, 2013 9:14:31 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Sep 10, 2013 9:14:31 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11274 ms

web.xml

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

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


    <description>iSAS</description>

    <filter>
        <filter-name>struts2</filter-name>
    <!--<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> -->
           <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>registration.jsp</welcome-file>
    </welcome-file-list>

 <jsp-config>
        <taglib>
            <taglib-uri>struts-tags.tld</taglib-uri>
            <taglib-location>/WEB-INF/tlds/struts-tags.tld</taglib-location>            
        </taglib>
        <taglib>
            <taglib-uri>tiles-jsp.tld</taglib-uri>
            <taglib-location>/WEB-INF/tlds/tiles-jsp.tld</taglib-location>          
        </taglib>   
    </jsp-config>

    <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.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
    </listener>

    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener> 
    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener> 
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>

</web-app>

struts.xml

<struts>

    <constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
    <constant name="struts.ui.theme" value="simple" />
    <constant name="struts.devMode" value="true" />

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

        <action name="userRegistration_*" method="{1}" class="userRegistration">
            <result name="SUCCESS" type="tiles">onlineexam.user.registration</result>
            <result name="ERROR" type="tiles">onlineexam.errorPage</result>
            <result name="input" type="tiles">onlineexam.user.registration</result>
        </action>

    </package>
</struts>

但我已经上传了所有需要的 jar。但是在 apache tomcat 7.0.42 中运行时它仍然给我以下错误我正在使用 Eclipse Kepler。请帮助我的朋友。

4

1 回答 1

3

更新到瓷砖 2.2。

Spring 3.0 需要 Tiles 2.1.2 或更高版本,并明确支持 Tiles 2.2。

缺失的方法:TilesInitializer.destroy()存在@since 2.2.0

或者您可能忘记部署其中一个瓷砖 jar,或者您有不同的版本

  • 瓦芯
  • 瓷砖-api
  • 瓷砖-jsp
  • 瓦片-servlet
于 2013-09-10T16:17:14.590 回答