本文介绍了Struts Spring& Hibernate在线考试的整合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我正在努力整合struts spring&网上考试系统休眠在运行项目时,它会抛出以下错误

  Http状态404  - 在线考试/ registration.jsp 

说明:请求的资源不可用。

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

 信息:跳过TLD。 URI:/ struts-tags已经定义
2013年9月10日9:14:28 PM org.apache.catalina.core.ApplicationContext日志
INFO:没有Spring class WebAccess在类路径上检测到初始化类型
2013年9月10日9:14:28 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE:异常发送上下文初始化事件到类org.apache.tiles.extras.complete.CompleteAutoloadTilesListener的监听器实例
java.lang.NoSuchMethodError:org.apache.tiles.startup.TilesInitializer.initialize(Lorg / apache / tiles / request / ApplicationContext;)V
在org.apache.tiles.web.startup.AbstractTilesListener.contextInitialized( AbstractTilesListener.java:53)
在org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
在org.apache.catalina.core.StandardContext.startInternal(StandardContext.java: 5434)
在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
在org.apache.catalina.core.ContainerBase $ StartChil d.call(ContainerBase.java:1559)
在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1549)
在java.util.concurrent.FutureTask.run( FutureTask.java:266)
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)
在java.lang.Thread.run(Thread.java:724)

2013年9月10日9:14:28 PM org.apache.catalina.core.ApplicationContext log
INFO:初始化Spring根WebApplicationContext
2013年9月10日9:14:31 PM org.apache.catalina.core.StandardContext startInternal
SEVERE:Error listenerStart
2013年9月10日9:14 :31 PM org.apache.catalina.core.StandardContext startInternal
SEVERE:上下文[/ iSAS]由于以前的错误而启动失败
2013年9月10日9:14:31 PM org.apache.catalina。 core.ApplicationContext log
INFO:关闭Spring根WebApplicationContext
2013年9月10日下午9:14:31 org.a pache.catalina.core.StandardContext listenerStop
SEVERE:异常发送上下文销毁事件到类org.apache.tiles.extras.complete.CompleteAutoloadTilesListener的监听器实例
java.lang.NoSuchMethodError:org.apache.tiles .startup.TilesInitializer.destroy()V
在org.apache.tiles.web.startup.AbstractTilesListener.contextDestroyed(AbstractTilesListener.java:63)
在org.apache.catalina.core.StandardContext.listenerStop (StandardContext.java:4980)
在org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
在org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java :232)
在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1559 )
在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1549)
在java.util.concurrent.FutureTask.run(FutureTask.java:266)
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)
在java.lang.Thread .run(Thread.java:724)

2013年9月10日9:14:31 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE:Web应用程序[/ iSAS]注册了JDBC驱动程序[com.mysql.jdbc.Driver],但在Web应用程序停止时未能注销它。为了防止内存泄漏,JDBC驱动程序已被强制取消注册。
2013年9月10日9:14:31 PM org.apache.coyote.AbstractProtocol start
INFO:启动ProtocolHandler [http-apr-8080]
2013年9月10日9:14 :31 PM org.apache.coyote.AbstractProtocol start
INFO:启动ProtocolHandler [ajp-apr-8009]
2013年9月10日下午9:14:31 org.apache.catalina.startup。 Catalina start
INFO:服务器启动在11274 ms

web.xml

 <?xml version =1.0encoding =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的/网络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.objectFactoryvalue =org.apache.struts2.spring.StrutsSpringObjectFactory/>
< constant name =struts.ui.themevalue =simple/>
< constant name =struts.devModevalue =true/>

< package name =defaultextends =struts-default>
< result-types>
< result-type name =tilesclass =org.apache.struts2.views.tiles.TilesResult/>
< / result-types>

< action name =userRegistration_ *method ={1}class =userRegistration>
< result name =SUCCESStype =tiles> onlineexam.user.registration< / result>
< result name =ERRORtype =tiles> onlineexam.errorPage< / result>
< result name =inputtype =tiles> onlineexam.user.registration< / result>
< / action>

< / package>
< / struts>

但是我已经上传了所有必需的jar。但是在apache中运行时仍然会出现以下错误tomcat 7.0.42
我正在使用Eclipse Kepler.Please帮助我的朋友。

解决方案

更新到瓷砖2.2。



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



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



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




  • tile-core

  • tiles-api

  • tiles-jsp

  • tiles-servlet


Actually I'm trying to integrate struts spring & hibernate on Online Examination System. While running the project it throws me the following error

Http Status 404 - online Exam/registration.jsp

Description: The requested resource is not available.

In console, the following things appears,

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>

But i have uploaded all the required jar's. But still it gives me the following error while running in apache tomcat 7.0.42I'm using Eclipse Kepler.Please help me friends.

解决方案

Update to Tiles 2.2.

Spring 3.0 requires Tiles 2.1.2 or above, with explicit support for Tiles 2.2.

The missing Method: TilesInitializer.destroy() exists @since 2.2.0

Or maybe your forget to deploy one of the tiles jars or you have different versions

  • tiles-core
  • tiles-api
  • tiles-jsp
  • tiles-servlet

这篇关于Struts Spring&amp; Hibernate在线考试的整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 23:46