struts2+spring+hibernate整合问题
这个是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="spring" />
<!--导入struts-default.xml文件 -->
<include file="struts-default.xml"></include>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<!-- 测试模块 -->
<package name="text" namespace="/text" extends="struts-default">
<global-results>
<result name="global" type="redirect">/UserList.jsp</result>
<result name="error" type="redirect">/error.jsp</result>
</global-results>
<action name="User_*" method="{1}" class="UserBizAction" >
</action>
</package>
<!-- 启动默认Action -->
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index"/>
<action name="UserBizAction" class="UserBizAction">
<result name="global" type="redirect">/UserList.jsp</result>
<result name="error" type="redirect">/error.jsp</result>
</action>
</package>
</struts>
这个是action的配置
<?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="UserBizAction" class="com.action.UserAction">
<property name="biz">
<ref bean="UserBiz"/>
</property>
</bean>
</beans>
这个是wed.xml的配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 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/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts Blank</display-name>
<!-- Spring ApplicationContext配置文件的路径,可使用通配符,多个路径用,号分隔,此参数用于后面的Spring Context Loader -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext-*.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<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>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
我用的jar是
xwork-2.0.7.jar , struts2-spring-plugin-2.0.14.jar, struts2-json-plugin0.30.jar , struts2-core-2.0.14.jar
等这些jar是在MyEclipse下运行的。
我在struts中配置了'UserBizAction' 为什么还报错呢?
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserBizAction' defined in file [D:\apache-tomcat-6.0.20\webapps\struts2Text\WEB-INF\classes\applicationContext-action.xml]: Cannot resolve reference to bean 'UserBiz' while setting bean property 'biz'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserBiz' defined in file [D:\apache-tomcat-6.0.20\webapps\struts2Text\WEB-INF\classes\applicationContext-biz.xml]: Cannot resolve reference to bean 'CommonDAO' while setting bean property 'commonDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CommonDAO' defined in file [D:\apache-tomcat-6.0.20\webapps\struts2Text\WEB-INF\classes\applicationContext-dao.xml]: Cannot resolve reference to bean 'SessionFactory' while setting bean property 'SessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in file [D:\apache-tomcat-6.0.20\webapps\struts2Text\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit