ssh weblogic jndi

望各位帮帮忙,在使用JNDI作为数据源时回报错:

下面是配置文件:
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd" default-autowire="byName" default-lazy-init="true">

<!-- properties -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:config/jdbc.properties</value>
<value>classpath*:config/hibernate.properties</value>
</list>
</property>
</bean>


<!-- AspectJ AOP -->
<aop:config proxy-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:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!--
<tx:method name="get*" read-only="true"  propagation="REQUIRED"/>
<tx:method name="find*" read-only="true"  propagation="REQUIRED"/>
-->
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>

<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>${DataSource.JNDI}</value>
</property>
<property name="resourceRef">
        <value>false</value>
        </property>
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">${DataSource.factory}</prop>
<prop key="java.naming.provider.url">${DataSource.url}</prop>
<prop key="java.naming.security.principal">${DataSource.user}</prop>
<prop key="java.naming.security.credentials">${DataSource.pwd}</prop>
</props>
</property>
</bean>   

<!-- sessionFactory configure and hibernate property -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingDirectoryLocations">
<list>
<value>classpath*:/net/northking/oms/entity</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">
${hibernate.show_sql}
</prop>
<!-- <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
<prop key="hibernate.cache.provider_class">${hibernate.cache.provider_class}</prop>
<prop key="hibernate.query.factory_class">${hibernate.query.factory_class}</prop>

<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>

<prop key="hibernate.jdbc.fetch_size">30</prop>
<prop key="hibernate.jdbc.batch_size">15</prop>-->
</props>
</property>
</bean>

<!--Hibernate TransactionManager-->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<!--spring jdbctemplate-->
<bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>

</beans>

在一个service中调用另一个service中的save方法后就会报错。
报错信息:
org.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access.
at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:427)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)
at net.northking.oms.service.scan.impl.SdiBmsArcAccountServiceImpl$$EnhancerByCGLIB$$3347cb1d.saveSdiBmsArc(<generated>)
at net.northking.oms.service.scan.impl.SdiArcArchiveToEcmServiceImpl.sdiArcArchiveToEcm(SdiArcArchiveToEcmServiceImpl.java:84)
at net.northking.oms.service.scan.impl.SdiArcArchiveToEcmServiceImpl$$FastClassByCGLIB$$e336bdb7.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)
at net.northking.oms.service.scan.impl.SdiArcArchiveToEcmServiceImpl$$EnhancerByCGLIB$$cae5997c.sdiArcArchiveToEcm(<generated>)
Hibernate: update SDI_BMS_ARC set CODE=?, 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=? where ID=?
at net.northking.oms.struts.action.scan.daemon.SdiAutoUpdateCatelogToDfc.run(SdiAutoUpdateCatelogToDfc.java:46)

猜你喜欢

转载自winnkl.iteye.com/blog/1312475