ssh整合struts2开发时出错

fancy_T 程序员  2015-12-10 12:23:20
严重: Dispatcher initialization failed
Unable to load configuration. - action - file:/F:/apache-tomcat-7.0.63/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:9:43
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.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4855)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5549)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: Action class [umAction] not found - action - file:/F:/apache-tomcat-7.0.63/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:9:43
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)
... 21 more
十二月 10, 2015 12:15:40 上午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - action - file:/F:/apache-tomcat-7.0.63/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:9:43
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.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4855)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5549)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: Unable to load configuration. - action - file:/F:/apache-tomcat-7.0.63/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:9:43
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)
... 18 more
Caused by: Action class [umAction] not found - action - file:/F:/apache-tomcat-7.0.63/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:9:43
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)
... 21 more
十二月 10, 2015 12:15:40 上午 org.apache.catalina.core.StandardContext startInternal
严重: One or more Filters failed to start. Full details will be found in the appropriate container log file
十二月 10, 2015 12:15:40 上午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/SSH2Integrate] startup failed due to previous errors
struts.xml中配置了的action为:<action name="doLogin" class="umAction">
<!-- 定义处理结果和资源之间的映射关系 -->
<result name="error">error.jsp</result>
<result name="success">success.jsp</result>
</action>
applicationContext.xml配置的bean为: <bean id="umAction" class="com.ssh2.action.UserManagerAction" scope="prototype">
<property name="userBiz" ref="userBiz" />
</bean>


...全文
221 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
小白晒太阳 2015-12-11
<action name="doLogin" class="umAction">class直接关联spring里面定义的bean就得需要将Struts2交给spring管理了,试试楼上的在 <!-- 设置Web应用的默认编码集为gbk --> <constant name="struts.i18n.encoding" value="gbk" />下面加上<constant name="struts.objectFactory" value="spring" />
回复
站立小海豹 2015-12-11
<action name="doLogin" class="umAction"> class是jdk反射加载的class,你这个写法不对
回复
qq_28797471 2015-12-11
<constant name="struts.objectFactory" value="spring"/>这个要加
回复
_南天北落 2015-12-10
你的struts.xml中配置了的action和applicationContext.xml配置的bean对应不上,所以才会报找不到umAction错误。你看看你的配置文件,你配置文件贴的太少我看不到。
回复
Turing Yang 2015-12-10
啥子呦,怎么这么配置
回复
小白晒太阳 2015-12-10
Unable to load configuration. - action - file:/F:/apache-tomcat-7.0.63/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:9:43 struts.xml第9行第43列看看
回复
_南天北落 2015-12-10
在<struts></struts>区域加入以下配置 首先要告知Struts 2运行时使用Spring来创建对象 <constant name="struts.objectFactory" value="spring" />
回复
fancy_T 2015-12-10
引用 1 楼 Tro_picana 的回复:
Unable to load configuration. - action - file:/F:/apache-tomcat-7.0.63/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:9:43 struts.xml第9行第43列看看
就是这句<action name="doLogin" class="umAction"> ,不知道为什么找不到bean中的umAction
回复
fancy_T 2015-12-10
引用 3 楼 my_God_sky 的回复:
你的struts.xml中配置了的action和applicationContext.xml配置的bean对应不上,所以才会报找不到umAction错误。你看看你的配置文件,你配置文件贴的太少我看不到。
applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" xmlns:tx="http://www.springframework.org/schema/tx"> <!-- 定义BasicDataSource数据源 --> <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"> <!-- 指定连接数据库的JDBC驱动 --> <property name="driverClassName" value="com.mysql.jdbc.Driver"> </property> <!-- 指定数据库所用的url--> <property name="url" value="jdbc:mysql://localhost:3306/bookshop"> </property> <!-- 指定连接数据库的用户名 --> <property name="username" value="root"></property> <!-- 指定连接数据库的密码 --> <property name="password" value="123456"></property> </bean> <!-- 定义Hibernate的SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <!-- 将上面定义的数据源dataSource注入到LocalSessionFactoryBean类的sessionFactory属性 --> <property name="dataSource"> <ref bean="dataSource" /> </property> <!-- 设置Hibernate的相关属性 --> <property name="hibernateProperties"> <props> <!-- 设置Hibernate的数据库方言 --> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> <!-- 将线程配置成Thread级别的 --> <prop key="hibernate.current_session_context_class"> thread </prop> </props> </property> <property name="mappingResources"> <list> <value>com/ssh2/entity/Users.hbm.xml</value></list> </property> </bean> <!-- 定义Hibernate事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 定义UserDAOImpl类实例,并将已经创建LocalSessionFactoryBean的实例 sessionFactory依赖注入给UserDAOImpl类中的sessionFactory属性 --> <bean id="userDAO" class="com.ssh2.dao.UserDAOImpl"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <!-- 定义UserBizImpl类实例,并给UserBizImpl类中的userDAO注入值 --> <bean id="userBiz" class="com.ssh2.biz.UserBizImpl"> <property name="userDAO" ref="userDAO" /> </bean> <!-- 部署Struts 2的负责用户管理的控制器UserManagerAction --> <bean id="umAction" class="com.ssh2.action.UserManagerAction" scope="prototype"> <property name="userBiz" ref="userBiz" /> </bean> </beans> struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <!-- 设置Web应用的默认编码集为gbk --> <constant name="struts.i18n.encoding" value="gbk" /> <package name="default" extends="struts-default"> <!-- 定义dolgon的Action,class属性使用Spring配置文件中 定义的相应的Bean实例名称--> <action name="doLogin" class="umAction"> <!-- 定义处理结果和资源之间的映射关系 --> <result name="error">error.jsp</result> <result name="success">success.jsp</result> </action> </package> </struts>
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-12-10 12:23
社区公告
暂无公告