this article
和
this one
. 除了冬眠,其他都很好。
我有:
<bean id="dataSourceCommon" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="url" value="jdbc:oracle:oci:@xxxx" />
<property name="username" value="xxxx" />
<property name="password" value="xxxx" />
<property name="maxActive" value="10" />
<property name="defaultAutoCommit" value="false" />
</bean>
<bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSourceCommon" />
<property name="mappingLocations">
<value>classpath:xxxx.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle10gDialect
</prop>
</props>
</property>
</bean>
<bean id="hibernateDaoSupport" abstract="true"
class="org.springframework.orm.hibernate3.support.HibernateDaoSupport">
<property name="sessionFactory" ref="hibernateSessionFactory" />
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="hibernateSessionFactory" />
</bean>
此文件位于AAR的根目录下。
我把这个aar文件复制到
c:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis2\WEB-INF\services
,但如果尝试运行Tomcat服务器,则会出现错误:
org.springframework.beans.factory.BeanCreationException:
中定义的“hibernateSessionFactory”
类路径资源
[xxxx.context.xml]:实例化
bean失败;嵌套异常为
无法实例化bean类
[org.springframework.orm.hibernate3.LocalSessionFactoryBean]:
例外情况是
java.lang.NoClassDefFoundError文件
原因:java.lang.ClassNotFoundException:
org.hibernate.cfg.Configuration配置