2 u013533380 u013533380 于 2015.07.12 14:25 提问

Struts2始终报错,请各位大神讲解

刚刚开始学习Struts2,配置正确但是始终不能运行.
错误信息:
Unable to load configuration. - action - file:/E:/workplace/j2eeworkplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ActionContext/WEB-INF/classes/struts.xml:10:67
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5546)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
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:745)
Caused by: Action class [org.crazyit.app.action.LoginAction] not found - action - file:/E:/workplace/j2eeworkplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ActionContext/WEB-INF/classes/struts.xml:10:67
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 17 more

七月 12, 2015 2:17:51 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - action - file:/E:/workplace/j2eeworkplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ActionContext/WEB-INF/classes/struts.xml:10:67
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:493)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5546)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
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:745)
Caused by: Unable to load configuration. - action - file:/E:/workplace/j2eeworkplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ActionContext/WEB-INF/classes/struts.xml:10:67
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)
... 14 more
Caused by: Action class [org.crazyit.app.action.LoginAction] not found - action - file:/E:/workplace/j2eeworkplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ActionContext/WEB-INF/classes/struts.xml:10:67
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 17 more

web.xml
<?xml version="1.0" encoding="GBK"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<!-- 定义Struts 2的核心Filter -->

struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

<!-- 让Struts 2的核心Filter拦截所有请求 -->

struts2
/*

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


<!-- Struts2的所有Action都需位于package下 -->

<!-- 定义名为login的Action,其实现类为LoginAction类 -->

<!-- 处理结果返回error,对应/WEB-INF/content/error.jsp视图资源 -->
/WEB-INF/content/error.jsp
<!-- 处理结果返回success,对应/WEB-INF/content/welcome.jsp视图资源 -->
/WEB-INF/content/welcome.jsp


/WEB-INF/content/{1}.jsp


5个回答

caozhy
caozhy   Ds   Rxr 2015.07.12 14:40

structs配置文件都没有加载,看看它部署上去了么?在正确的位置么?内容正确么

yingzi19911010
yingzi19911010   2015.07.12 15:58

检查一下是不是struts.xml里面的action对应的类名写错了

cuiwei1026522829
cuiwei1026522829   Ds   Rxr 2015.07.12 21:00

file:/E:/workplace/j2eeworkplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ActionContext/WEB-INF/classes/struts.xml:10:67 这个文件第十行,第67个字符有问题

Action class [org.crazyit.app.action.LoginAction] not found - action 这个action配置有问题,没有发现

u013533380
u013533380 不过我用myeclipse运行一次就成功了,但是为什么在eclipse上就不行
2 年多之前 回复
u013533380
u013533380 我改后还是提示 Not Found
2 年多之前 回复
lingfeiwen
lingfeiwen   2015.07.14 12:27

建议重新new一个服务器再次发布。不要用现在的这个服务器。可能是服务器引起。

miracle_yao
miracle_yao   2015.07.24 09:48

是不是struts.xml配置Action配置出错了

Csdn user default icon
上传中...
上传图片
插入图片