[
https://issues.jboss.org/browse/WFLY-2960?page=com.atlassian.jira.plugin....
]
ofbiz brazil edited comment on WFLY-2960 at 2/25/14 9:48 AM:
-------------------------------------------------------------
So, JpaTransactionManager allows to inject a LocalContainerEntityManagerFactoryBean, while
JtaTransactionManager doesn't allow.
By the way, JpaTransactionManager and JtaTransactionManager implements
PlatformTransactionManager, which in the main interface for Spring manage Transactions.
The focus point that rocks me, is why in JBoss 7.1.1. works without issues?
was (Author: ofbizbrazil):
So, JpaTransactionManager allows to inject aLocalContainerEntityManagerFactoryBean,
while JtaTransactionManager doesn't allow.
By the way, JpaTransactionManager and JtaTransactionManager implements
PlatformTransactionManager, which in the main interface for Spring manage Transactions.
The focus point that rocks me, is why in JBoss 7.1.1. works without issues?
Hibernate 4.3.1 can't find [java:jboss/UserTransaction] - JTA
-------------------------------------------------------------
Key: WFLY-2960
URL:
https://issues.jboss.org/browse/WFLY-2960
Project: WildFly
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: JPA / Hibernate
Affects Versions: 8.0.0.Final
Environment: Spring 4.0.1, Hibernate 4.3.1, Hibernate Validator 5.0.3.Final, EJB
3.1
Reporter: ofbiz brazil
Assignee: Scott Marlow
Priority: Critical
1) There's no UserTransaction implemented by WildFly.
JNDI tree view shows:
=== WildFly 8.0.0Final ===
"java:jboss" => {
"UserTransaction" => {
"class-name" => "javax.transaction.UserTransaction",
"value" => "UserTransaction"
},
=== JBoss 7.1.1 ===
"java:jboss" => {
"UserTransaction" => {
"class-name" =>
"org.jboss.tm.usertx.client.ServerVMClientUserTransaction",
"value" =>
"org.jboss.tm.usertx.client.ServerVMClientUserTransaction@9e85f"
},
2) Method locateUserTransaction in JBossAppServerJtaPlatform can't get transaction
objet from JNDI tree.
3) Hibernate Configuration
hibernate.default_schema=dbo
hibernate.default_catalog=XX
hibernate.database=SQL_SERVER
hibernate.dialect=org.hibernate.dialect.SQLServer2008Dialect
hibernate.show_sql=false
hibernate.generate_ddl=false
hibernate.hbm2ddl.auto=validate
hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.jta.platform=org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform
hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringJtaSessionContext
hibernate.connection.release_mode=auto
4) Runtime Exception in console
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not
open JPA EntityManager for transaction; nested exception is
javax.persistence.PersistenceException: org.hibernate.engine.jndi.JndiException: unable to
find UserTransaction
at
org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:430)
[spring-orm-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
[spring-tx-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at
org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:420)
[spring-tx-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:257)
[spring-tx-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
[spring-tx-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
[spring-aop-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
[spring-aop-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at com.sun.proxy.$Proxy102.findByUserProfile(Unknown Source)
at
com.sbb.useraccess.ejb.AccessibleItemBean.findByUserProfile(AccessibleItemBean.java:74)
[classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[rt.jar:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.7.0_51]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]
at
org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at
org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:407)
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.delegateInterception(Jsr299BindingsInterceptor.java:70)
[wildfly-weld-8.0.0.Final.jar:8.0.0.Final]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:80)
[wildfly-weld-8.0.0.Final.jar:8.0.0.Final]
at
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)
[wildfly-weld-8.0.0.Final.jar:8.0.0.Final]
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
at
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at
org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
[wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at
org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:407)
at
org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:46)
[weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at
org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
[wildfly-weld-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at
org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
[wildfly-ee-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at
org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at
org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at
org.jboss.as.ejb3.component.singleton.SingletonComponentInstanceAssociationInterceptor.processInvocation(SingletonComponentInstanceAssociationInterceptor.java:52)
[wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:273)
[wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
... 99 more
Caused by: javax.persistence.PersistenceException:
org.hibernate.engine.jndi.JndiException: unable to find UserTransaction
at
org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763)
[hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
at
org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677)
[hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
at
org.hibernate.jpa.spi.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1771)
[hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.jpa.internal.TransactionImpl.begin(TransactionImpl.java:64)
[hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
at
org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:67)
[spring-orm-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at
org.springframework.orm.jpa.vendor.HibernateJpaDialect.beginTransaction(HibernateJpaDialect.java:110)
[spring-orm-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at
org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:380)
[spring-orm-4.0.1.RELEASE.jar:4.0.1.RELEASE]
... 141 more
Caused by: org.hibernate.engine.jndi.JndiException: unable to find UserTransaction
at
org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform.locateUserTransaction(JBossAppServerJtaPlatform.java:77)
[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at
org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform.retrieveUserTransaction(AbstractJtaPlatform.java:124)
[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at
org.hibernate.engine.transaction.internal.jta.JtaTransaction.locateUserTransaction(JtaTransaction.java:84)
[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at
org.hibernate.engine.transaction.internal.jta.JtaTransaction.doBegin(JtaTransaction.java:69)
[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at
org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162)
[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1431)
[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.jpa.internal.TransactionImpl.begin(TransactionImpl.java:61)
[hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
... 144 more
Caused by: org.hibernate.engine.jndi.JndiException: Unable to lookup JNDI name
[java:jboss/UserTransaction]
at org.hibernate.engine.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:117)
[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at
org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform.locateUserTransaction(JBossAppServerJtaPlatform.java:70)
[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
... 150 more
Caused by: javax.naming.NamingException: JBAS014237: Only session and message-driven
beans with bean-managed transaction demarcation are allowed to access UserTransaction
[Root exception is java.lang.IllegalStateException: JBAS014237: Only session and
message-driven beans with bean-managed transaction demarcation are allowed to access
UserTransaction]
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:142)
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:81)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:202)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
at
org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:235)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
at javax.naming.InitialContext.lookup(InitialContext.java:415) [rt.jar:1.7.0_51]
at javax.naming.InitialContext.lookup(InitialContext.java:415) [rt.jar:1.7.0_51]
at org.hibernate.engine.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:114)
[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
... 151 more
Caused by: java.lang.IllegalStateException: JBAS014237: Only session and message-driven
beans with bean-managed transaction demarcation are allowed to access UserTransaction
at
org.jboss.as.ejb3.component.allowedmethods.AllowedMethodsInformation.realCheckPermission(AllowedMethodsInformation.java:138)
[wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
at
org.jboss.as.ejb3.component.allowedmethods.AllowedMethodsInformation.checkAllowed(AllowedMethodsInformation.java:112)
[wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
at
org.jboss.as.ejb3.subsystem.EJB3UserTransactionAccessControlService$1.authorizeAccess(EJB3UserTransactionAccessControlService.java:53)
[wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
at
org.jboss.as.txn.service.UserTransactionAccessControlService.authorizeAccess(UserTransactionAccessControlService.java:83)
at
org.jboss.as.txn.service.UserTransactionBindingService$1.getReference(UserTransactionBindingService.java:71)
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:140)
... 159 more
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira