Bonjour,

suite à la traduction EJB2 vers EJB3, j'ai un problème de transactions au niveau de jboss
l'erreur client :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/221, BranchQual=, localId=221] status=STATUS_NO_TRANSACTION
	at org.jboss.aspects.tx.TxPolicy.handleEndTransactionException(TxPolicy.java:198)
	at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:180)
	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:225)
	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
Caused by: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/221, BranchQual=, localId=221] status=STATUS_NO_TRANSACTION
	at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
	at org.jboss.tm.TxManager.commit(TxManager.java:240)
	at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:225)
	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
	at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
	at org.jboss.remoting.Client.invoke(Client.java:525)
	at org.jboss.remoting.Client.invoke(Client.java:488)
	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
	at $Proxy0.searchAllParametre(Unknown Source)
	at script.ScriptPatch.test(ScriptPatch.java:74)
	at script.ScriptPatch.main(ScriptPatch.java:65)
cette erreur n'est pas systématique, elle ne se produit jamais au même moment.
les warn serveur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
09:47:52,910 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/203, BranchQual=, localId=203] timed out. status=STATUS_ACTIVE
09:47:52,926 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/204, BranchQual=, localId=204] timed out. status=STATUS_ACTIVE
09:47:52,941 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/205, BranchQual=, localId=205] timed out. status=STATUS_ACTIVE
09:47:52,974 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/206, BranchQual=, localId=206] timed out. status=STATUS_ACTIVE
09:47:52,974 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/207, BranchQual=, localId=207] timed out. status=STATUS_ACTIVE
09:47:52,974 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/208, BranchQual=, localId=208] timed out. status=STATUS_ACTIVE
09:47:52,989 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/209, BranchQual=, localId=209] timed out. status=STATUS_ACTIVE
09:47:52,989 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/210, BranchQual=, localId=210] timed out. status=STATUS_ACTIVE
09:47:52,989 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/211, BranchQual=, localId=211] timed out. status=STATUS_ACTIVE
09:47:52,989 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/212, BranchQual=, localId=212] timed out. status=STATUS_ACTIVE
09:47:53,005 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/213, BranchQual=, localId=213] timed out. status=STATUS_ACTIVE
09:47:53,005 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/214, BranchQual=, localId=214] timed out. status=STATUS_ACTIVE
09:47:53,005 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/215, BranchQual=, localId=215] timed out. status=STATUS_ACTIVE
09:47:55,158 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/216, BranchQual=, localId=216] timed out. status=STATUS_ACTIVE
09:47:55,190 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/217, BranchQual=, localId=217] timed out. status=STATUS_ACTIVE
09:47:55,221 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/218, BranchQual=, localId=218] timed out. status=STATUS_ACTIVE
09:47:55,252 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/219, BranchQual=, localId=219] timed out. status=STATUS_ACTIVE
09:47:55,268 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/220, BranchQual=, localId=220] timed out. status=STATUS_ACTIVE
09:47:55,283 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=ABCD/221, BranchQual=, localId=221] timed out. status=STATUS_ACTIVE
voici une partie de mon session bean
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
@Stateless
@TransactionAttribute(value = TransactionAttributeType.REQUIRED)
public class FrameworkSessionBean implements FrameworkSessionLocal, FrameworkSessionRemote {
 
	private static Logger log = Logger.getLogger(FrameworkSessionBean.class);
 
	@PersistenceContext(unitName = "FrameworkPU")
	private EntityManager em;
 
	@Override
	public ConfigurationInfo getConfiguration(ConfigurationPK pk) {
		return em.find(ConfigurationInfo.class, pk);
	}
 
	@Override
	public void updateConfiguration(ConfigurationInfo info) {
		em.merge(info);		
	}
 
	@Override
	public void saveParametres(Collection<ParametreInfo> col) {
		em.merge(col);			
	}
 
	@Override
	public Collection<ParametreInfo> searchAllParametre() {
		Query q = em.createNamedQuery("FIND_ALL_PARAM");
		try {
			return q.getResultList();
		} catch (NoResultException e) {
			return new ArrayList<ParametreInfo>();
		}
	}
et le persistence.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
<persistence 
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0"
>
	<persistence-unit name="FrameworkPU">
		<provider>org.hibernate.ejb.HibernatePersistence</provider>
		<jta-data-source>java:/Framework</jta-data-source>
		<properties>
			<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
 
            <!--   configuration du cache jboss 4 --> 
            <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
            <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/>
            <property name="hibernate.cache.use_query_cache" value="true"/>
            <property name="hibernate.cache.use_second_level_cache" value="true"/>
		</properties>
	</persistence-unit>
</persistence>
et la datasource :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
<datasources>
  <!--local-tx-datasource>
    <jndi-name>Framework</jndi-name>
    <connection-url>jdbc:postgresql://A.B.C.D:5432/framework</connection-url>
    <driver-class>org.postgresql.Driver</driver-class>
    <user-name>X</user-name>
    <password>Y</password>
  </local-tx-datasource-->
   <xa-datasource>
     <jndi-name>Framework</jndi-name>
 
     <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
     <xa-datasource-property name="ServerName">A.B.C.D</xa-datasource-property>
     <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
 
     <xa-datasource-property name="DatabaseName">framework</xa-datasource-property>
     <xa-datasource-property name="User">X</xa-datasource-property>
     <xa-datasource-property name="Password">Y</xa-datasource-property>
 
     <track-connection-by-tx></track-connection-by-tx>
   </xa-datasource>
</datasources>
local-tx-datasource ou xa-datasource, même erreur

merci