错误如下:
Class 'org.springframework.orm.hibernate3.support' not found
跪求各位大佬帮忙解决!
相关说明:
用的软件是myeclipse10
SSH框架
struts2.1+spring2.5+hibernate3.1.3
提问:
我已经引入相关jar包到lib文件夹下,lib中也能找到文件,为什么仍然说找不到。clean过了也没用。。
我到相关项目的lib下用360压缩打开文件,查看过版本号,都对……
所以应该不是导入错了包,冲突的包应该也不是这个错误吧。。
所以就很郁闷,希望各位大佬能解答!
同时想请问哪里能找到struts2.1+spring2.5+hibernate3.1.3的Jar包集合,受够了myeclipse的添加struts,spring,hibernate。经常出错
相关配置文件如下:
applicationContext-core.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"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- 配置数据库相关信息 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/ssh"></property>
<property name="username" value="root"></property>
</bean>
<!-- sessionFactory 初始化hibernate属性-->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<!-- 配置映射文件 -->
<property name="mappingResources">
<list>
<value>com/model/User.hbm.xml</value>
</list>
</property>
</bean>
<!-- 配置spring的声明式事务 -->
<!-- 事务管理bean -->
<bean id="transationManger"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 声明式事务的配置 -->
<tx:advice id="txAdvice" transaction-manager="transationManger">
<!-- 事务属性定义 -->
<tx:attributes>
<tx:method name="*" propagation="REQUIRED"/><!-- name="*" 表示所有方法全部加入事务处理 -->
<tx:method name="add*" rollback-for="EXCEPTION"/>
<tx:method name="get*" propagation="NEVER"/><!-- 不执行事务操作 -->
<tx:method name="set*" propagation="NEVER"/><!-- 不执行事务操作 -->
</tx:attributes>
</tx:advice>
<!-- AOP实现 -->
<aop:config>
<!-- 切入点的配置,哪些类和方法进入到表达式中 -->
<aop:pointcut expression="execution(* com.service.*.*(..))" id="allMethods"/>
<!-- 把切入点和事务整合在一起 -->
<aop:advisor advice-ref="txAdvice" pointcut-ref="allMethods"/>
</aop:config>
<!-- 配置HibernateDaoSupport(抽象类) -->
<bean id="hibernateDaoSupport" class="org.springframework.orm.hibernate3.support"
abstract="true">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
</beans>
以下是:
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"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<import resource="applicationContext-core.xml"></import>
<import resource="applicationContext-action.xml"></import>
<import resource="applicationContext-dao.xml"></import>
<import resource="applicationContext-service.xml"></import>
</beans>