ssh weblogic jndi
望各位帮帮忙,在使用JNDI作为数据源时回报错:
下面是配置文件:
<?xmlversion="1.0"encoding="UTF-8"?>
<beansxmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.0.xsd"default-autowire="byName"default-lazy-init="true">
<!--properties-->
<beanid="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<propertyname="locations">
<list>
<value>classpath*:config/jdbc.properties</value>
<value>classpath*:config/hibernate.properties</value>
</list>
</property>
</bean>
<!--AspectJAOP-->
<aop:configproxy-target-class="true">
<aop:advisor
pointcut="execution(*oms.service..*.*(..))"
advice-ref="txAdvice"/>
</aop:config>
<aop:config>
<aop:advisor
pointcut="execution(*oms.service.scan.impl.*Service*.*(..))"
advice-ref="txAdvice"/>
</aop:config>
<tx:adviceid="txAdvice"transaction-manager="transactionManager">
<tx:attributes>
<!--
<tx:methodname="get*"read-only="true"propagation="REQUIRED"/>
<tx:methodname="find*"read-only="true"propagation="REQUIRED"/>
-->
<tx:methodname="*"propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<beanid="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<propertyname="jndiName">
<value>${DataSource.JNDI}</value>
</property>
<propertyname="resourceRef">
<value>false</value>
</property>
<propertyname="jndiEnvironment">
<props>
<propkey="java.naming.factory.initial">${DataSource.factory}</prop>
<propkey="java.naming.provider.url">${DataSource.url}</prop>
<propkey="java.naming.security.principal">${DataSource.user}</prop>
<propkey="java.naming.security.credentials">${DataSource.pwd}</prop>
</props>
</property>
</bean>
<!--sessionFactoryconfigureandhibernateproperty-->
<beanid="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<propertyname="dataSource"ref="dataSource"/>
<propertyname="mappingDirectoryLocations">
<list>
<value>classpath*:/net/northking/oms/entity</value>
</list>
</property>
<propertyname="hibernateProperties">
<props>
<propkey="hibernate.dialect">
${hibernate.dialect}
</prop>
<propkey="hibernate.show_sql">
${hibernate.show_sql}
</prop>
<!--<propkey="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
<propkey="hibernate.cache.provider_class">${hibernate.cache.provider_class}</prop>
<propkey="hibernate.query.factory_class">${hibernate.query.factory_class}</prop>
<propkey="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
<propkey="hibernate.jdbc.fetch_size">30</prop>
<propkey="hibernate.jdbc.batch_size">15</prop>-->
</props>
</property>
</bean>
<!--HibernateTransactionManager-->
<beanid="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<propertyname="sessionFactory"ref="sessionFactory"/>
</bean>
<!--springjdbctemplate-->
<beanid="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate">
<propertyname="dataSource">
<refbean="dataSource"/>
</property>
</bean>
</beans>
在一个service中调用另一个service中的save方法后就会报错。
报错信息:
org.springframework.transaction.IllegalTransactionStateException:Pre-boundJDBCConnectionfound!HibernateTransactionManagerdoesnotsupportrunningwithinDataSourceTransactionManageriftoldtomanagetheDataSourceitself.ItisrecommendedtouseasingleHibernateTransactionManagerforalltransactionsonasingleDataSource,nomatterwhetherHibernateorJDBCaccess.
atorg.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:427)
atorg.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)
atorg.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:262)
atorg.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
atorg.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
atorg.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)
atnet.northking.oms.service.scan.impl.SdiBmsArcAccountServiceImpl$$EnhancerByCGLIB$$3347cb1d.saveSdiBmsArc(<generated>)
atnet.northking.oms.service.scan.impl.SdiArcArchiveToEcmServiceImpl.sdiArcArchiveToEcm(SdiArcArchiveToEcmServiceImpl.java:84)
atnet.northking.oms.service.scan.impl.SdiArcArchiveToEcmServiceImpl$$FastClassByCGLIB$$e336bdb7.invoke(<generated>)
atnet.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
atorg.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
atorg.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
atorg.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
atorg.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
atorg.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)
atnet.northking.oms.service.scan.impl.SdiArcArchiveToEcmServiceImpl$$EnhancerByCGLIB$$cae5997c.sdiArcArchiveToEcm(<generated>)
Hibernate:updateSDI_BMS_ARCsetCODE=?,NAME=?,DESCRIPTION=?,TYPE=?,INDEX_NO=?,STATUS=?,STATUS_CODE=?,PARENT_ID=?,CREATEOR=?,CREATE_TIME=?,PRIORITY=?,ORG_CODE=?,TELLER_CODE=?,TR_DATE=?,IMAGE_NUM=?,FRONT_NUM=?,DOC_NUM=?,CAPTURER=?,CAPTURE_TIME=?,INPUTER=?,INPUT_TIME=?,OCR_SERVER_ID=?,AUTO_MATCH_SERVER_ID=?,AUDIT_OK_NUM=?,EXCEPTION_REASON=?,IS_NEED_AUTO_MATCH=?,CHECK_IMAGE_TOTAL_FILES=?,CHECK_IMAGE_TOTAL_DB=?whereID=?
atnet.northking.oms.struts.action.scan.daemon.SdiAutoUpdateCatelogToDfc.run(SdiAutoUpdateCatelogToDfc.java:46)