设为首页 收藏本站
查看: 620|回复: 0

[经验分享] ssh weblogic jndi

[复制链接]

尚未签到

发表于 2017-2-15 09:12:00 | 显示全部楼层 |阅读模式
望各位帮帮忙,在使用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)

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-342300-1-1.html 上篇帖子: weblogic doc 下篇帖子: weblogic官方文档
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表