S2SH框架整合出现的一个问题

Ginie 广州一康医疗设备实业有限公司 项目经理  2010-10-16 03:04:48
服务器报错

信息: Initializing Spring root WebApplicationContext
2010-10-16 15:00:40 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts
Unable to load configuration. - action - file:/E:/SSH%20sqpce/S2SHTest/WebRoot/WEB-INF/classes/struts.xml:9:49
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Unable to load configuration. - action - file:/E:/SSH%20sqpce/S2SHTest/WebRoot/WEB-INF/classes/struts.xml:9:49
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)
... 19 more
Caused by: Action class [RegisterAction] not found - action - file:/E:/SSH%20sqpce/S2SHTest/WebRoot/WEB-INF/classes/struts.xml:9:49
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:409)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:354)
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)
... 21 more
2010-10-16 15:00:40 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2010-10-16 15:00:40 org.apache.catalina.core.StandardContext start
严重: Context [S2SHTest] startup failed due to previous errors
2010-10-16 15:00:41 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext


我的配置是
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>
<package name="S2SH" extends="struts-default">

<action name="register" class="RegisterAction">
<result name="success">/index.jsp</result>
<result name="input">/register.jsp</result>
</action>
</package>
</struts>

application.xml
[code=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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">


<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/mldn?useUnicode=true&characterEncoding=UTF-8">
</property>
<property name="username" value="root"></property>
<property name="password" value=""></property>
<!-- 最大活动连接数 -->
<property name="maxActive" value="100"></property>
<!-- 最大可空闲连接数 -->
<property name="maxIdle" value="30"></property>
<!-- 最大可等待连接数 -->
<property name="maxWait" value="500"></property>
<!-- 默认的提交方式(如果不需要事务可以设置成true,在实际应用中一般设置为false,默认为false) -->
<property name="defaultAutoCommit" value="true"></property>
</bean>


<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>

<!-- hibernate方言等相关配置 -->
<property name="hibernateProperties">
<props>
<prop key="connection.useUnicode">true</prop>
<prop key="connection.characterEncoding">utf-8</prop>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>

</props>
</property>

<!-- hbm.xml的映射文件 -->
<property name="mappingResources">
<list>
<value>com/hackbase/www/vo/User.hbm.xml</value>
</list>
</property>
</bean>


<bean id="iuserdao" class="com.hackbase.www.DAOImpl.IUserDAOImpl"
scope="singleton">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>

<bean id="userService"
class="com.hackbase.www.serviceimpl.UserServiceImpl">

<property name="iuserdao" ref="iuserdao"></property>
</bean>


<bean id="RegisterAction"
class="com.hackbase.www.action.RegisterAction" scope="prototype">
<property name="service" ref="userService"></property>
</bean>
</beans>


[/code]

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
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">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>


<filter>
<filter-name>struts</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>

<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


<!-- 配置spring的监听器 -->

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
</web-app>



哪位大哥大姐可以告诉我下是哪里的问题呀,拜托了
...全文
111 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
lzsxf11 2010-10-18
一般都是包的冲突问题
Hibernate core下面的xerces.jar包去掉看看
回复
刚刚我也出了,不过弄好了,楼主贴下你的jar包,注意一点就是如果楼主用的是最新版本也就是2.2.1的struts的时候ognl-3.0.jar需要加载javassist.3.7.ga.jar这个版本,这个问题我的是jar包的问题
回复
yodlove 2010-10-17
你的spring配置呢
回复
magong 2010-10-16
[Quote=引用 3 楼 g6785654 的回复:]

改后是可以的
[/Quote]
改后行了,说明你Struts没问题了。
后面就是将Spring集成到Struts中,这个要麻烦一点了,给你一个网址参考一下吧
http://forjava.javaeye.com/blog/129499
回复
javahailangL 2010-10-16
在 看看 路径
回复
Ginie 2010-10-16
哪位帮我下嘛,SSH整的头都晕掉了的
回复
Ginie 2010-10-16
改后是可以的
回复
zn85600301 2010-10-16




<struts>
<package name="S2SH" extends="struts-default">

<action name="register" class="RegisterAction">
<result name="success">/index.jsp</result>
<result name="input">/register.jsp</result>
</action>
</package>
</struts>
RegisterAction 改成com.hackbase.www.action.RegisterAction 试试
回复
magong 2010-10-16
[Quote=引用楼主 g6785654 的回复:]
Caused by: Action class [RegisterAction] not found - action - file:/E:/SSH%20sqpce/S2SHTest/WebRoot/WEB-INF/classes/struts.xml:9:49

<action name="register" class="RegisterAction">

[/Quote]
前面报的是类找不到错,
可将后面struts.xml文件中class属性修改为com.hackbase.www.action.RegisterAction

调试通了后再考虑Spring注入
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2010-10-16 03:04
社区公告
暂无公告