无法在Struts中加载配置 [英] Unable to load Configuration in Struts

查看:119
本文介绍了无法在Struts中加载配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在网上考试中实施STRUTS SPRING和HIBERNATE INTEGRATION。在Eclipse Kepler中使用apache tomcat 7.0.42运行项目时,它会抛出以下错误:

  ** HTTP状态404  - /OnlineExam/registration.jsp** 
**描述:**请求的资源不可用。

在控制台日志中,出现以下情况:

  SEVERE:异常开始过滤器struts2 
无法加载配置。 - action - file:/ C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/iSAS/WEB-INF/classes/struts.xml:16:73
在org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org .apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
在org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
。在组织INIT> .apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)$ b $ LT b。在org.apache.catalina.core.ApplicationFilterConfig&(ApplicationFilterConfig.java:107)
。在有机apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775)
处org.apache.catalina org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
。 util.LifecycleBase.start(LIF
at org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase $ StartChild.call( $ b $ java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)$ b $在java.lang.Thread.run(Thread.java:724)
导致:无法加载组态。 - action - file:/ C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/iSAS/WEB-INF/classes/struts.xml:16:73
在com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
在org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
在org.apache .struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
... 14 more
在命名空间中创建操作userRegistration的结果时出错 - 操作 - 文件:/ C:/ workspace / .metadata / .plugins / org.eclipse.wst.server.core / tmp3 / wtpwebapps / iSAS / WEB-INF / classes / struts.xml:16:73
at com.opensymphony.xwork2.config.providers。 XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:367)
处com.opensymphony.xwork2.config.providers com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)
。 XmlConfigurationProvider.loadPackages(XmlConfi gurationProvider.java:264)
在org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)在com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration
。 java:193)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 16 more
导致:没有为键入名为'SUCCESS'的映射。你的意思是'瓷砖'? - result - file:/ C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/iSAS/WEB-INF/classes/struts.xml:17:40
在com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildResults(XmlConfigurationProvider.java:621)
在com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:365)
... 21 more

struts.xml

 <?xml version =1.0encoding =UTF-8?> 
<!DOCTYPE struts PUBLIC - // Apache Software Foundation // DTD Struts Configuration 2.0 // EN
http://struts.apache.org/dtds/struts-2.0.dtd >

< struts>

< constant name =struts.objectFactoryvalue =org.apache.struts2.spring.StrutsSpringObjectFactory/>
< constant name =struts.ui.themevalue =simple/>
< constant name =struts.devModevalue =true/>

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

< action name =userRegistrationmethod ={1}class =userRegistration>
< result name =SUCCESStype =tiles> isas.user.registration< / result>
< result name =ERRORtype =tiles> isas.errorPage< / result>
< result name =inputtype =tiles> isas.user.registration< / result>
< / action>

< / package>
< / struts>

请帮助我的朋友。我不知道为什么会出现。无论如何,先谢谢了...... !!! 解决方案

我认为你错过了struts2-spring-plugin-2.1。 6.jar文件,请在您的课程路径中检查它。

I'm trying to implement STRUTS SPRING AND HIBERNATE INTEGRATION ON ONLINE EXAMINATION. while running the project in Eclipse Kepler using apache tomcat 7.0.42, it throws me the following error

**HTTP Status 404 - /OnlineExam/registration.jsp**
**Description:**The requested resource is not available.

In Console log, following things appear,

    SEVERE: Exception starting filter struts2
Unable to load configuration. - action - file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/iSAS/WEB-INF/classes/struts.xml:16:73
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
    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)
Caused by: Unable to load configuration. - action - file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/iSAS/WEB-INF/classes/struts.xml:16:73
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
    ... 14 more
Caused by: Error building results for action userRegistration in namespace  - action - file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/iSAS/WEB-INF/classes/struts.xml:16:73
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:367)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 16 more
Caused by: There is no result type defined for type 'tiles' mapped with name 'SUCCESS'.  Did you mean 'tiles'? - result - file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/iSAS/WEB-INF/classes/struts.xml:17:40
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildResults(XmlConfigurationProvider.java:621)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:365)
    ... 21 more

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>

    <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">isas.user.registration</result>
            <result name="ERROR" type="tiles">isas.errorPage</result>
            <result name="input" type="tiles">isas.user.registration</result>
        </action>

    </package>
</struts>

Please Help me Friends. I don't know why that appears. Anyway thanks in Advance...!!!

解决方案

I think you are missing the "struts2-spring-plugin-2.1.6.jar" file, please check it in your classpath

这篇关于无法在Struts中加载配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆