-
1. Re: Jboss7.1 arjuna configuration
pushpak1981 Jan 16, 2012 10:12 AM (in response to pushpak1981)We have deployed 2 different ear. We are accessing jta resources of first ear into second ear code.
-
2. Re: Jboss7.1 arjuna configuration
mmusgrov Jan 16, 2012 10:27 AM (in response to pushpak1981)You can configure JBossTS properties via system properties. For example, inside the server config element add:
<system-properties>
<property name="com.arjuna.ats.arjuna.allowMultipleLastResources" value="true"/>
com.arjuna.ats.arjuna.allowMultipleLastResources
</system-properties>
-
3. Re: Jboss7.1 arjuna configuration
pushpak1981 Jan 17, 2012 1:35 AM (in response to mmusgrov)Thanks for the reply. We tried to set the propety. Our warning messge is gone. But when we try to add data its not getting committed into the database. Is there anything that needs to be done when we try to access first application datasource from second application ?
We are using Oracle11g driver and we tried with both XA and non xa datasource but the behaviour is the same.
-
4. Re: Jboss7.1 arjuna configuration
tomjenkinson Jan 25, 2012 5:02 AM (in response to pushpak1981)Pushpak1981, sorry for the delay in getting back to you.
If this was me, I would be trying to get the following configuration to work:
1. Be using XA for the oracle driver
2. Be *not* using (excuse my poor grammar there sorry) allowMultipleLastResources as I don;t think you should need it for Oracle
3. Be using the xa-datasource configuration in JBoss xml
The datasource is configured in the standalone.xml right? Please can you provide the datasource configuration you are using?
I dont think that you need multiple 1PC resources as you are using Oracle so it should be ok to just use xa-datasource.
I am going to assume this is impossible for you but if you can provide:
1. The configuration you are using
2. A cut down example showing the error
I would be very happy to get it up and running here for you/
At the least, I would ensure you are only using XA and xa-datasource, disable allowMultipleLastResources as it will mask any issues with your configuration related to using xa-datasources and try again. Afterwards, if you can send some snippets of code and configuration we can take a look.
Hope it helps,
Tom
-
5. Re: Jboss7.1 arjuna configuration
als Apr 8, 2012 1:20 PM (in response to tomjenkinson)Hello Tom.
1. am using JBoss 7.1.1.final and got the exactly same situation.
2.TimerEjb is connecting via Local Interface some session ejb which tries to commit JTA to MysQL DB.
3.Same flow from outside EJB client via Remote Interface to the same Session EJB works fine
error is
19:45:03,388 WARN [com.arjuna.ats.arjuna] (EJB default - 1) ARJUNA012140: Adding multiple last resources is disallowed. Trying to add LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@8d3f0f[connectionListener=2e9161 connectionManager=127286f warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffc0a80067:335e27a:4f81bf50:23, node_name=1, branch_uid=0:ffffc0a80067:335e27a:4f81bf50:2a, subordinatenodename=null, eis_name=unknown eis name >])), but already have LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@12130f5[connectionListener=9cc465 connectionManager=8edd02 warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffc0a80067:335e27a:4f81bf50:23, node_name=1, branch_uid=0:ffffc0a80067:335e27a:4f81bf50:28, subordinatenodename=null, eis_name=unknown eis name >]))
19:45:03,402 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB default - 1) SQL Error: 0, SQLState: null
19:45:03,404 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB default - 1) javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@2e9161[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@780239 connection handles=0 lastUse=1333903503402 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@d9f294 pool internal context=SemaphoreArrayListManagedConnectionPool@12fab25[pool=MyDataSource] xaResource=LocalXAResourceImpl@8d3f0f[connectionListener=2e9161 connectionManager=127286f warned=false currentXid=null] txSync=null]
19:45:03,437 WARN [com.arjuna.ats.arjuna] (EJB default - 1) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a80067:335e27a:4f81bf50:29, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@f99011 >: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1295) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
Of course , when trying to put allowmultiple transactions, error is going away but data are not commited
It smell like a critical bug,no?
Thanks in advance
Alexey
-
6. Re: Jboss7.1 arjuna configuration
tomjenkinson Apr 9, 2012 2:48 AM (in response to als)Hi Alexey,
Out of interest, are you actually intending there to be multiple last resources? If not, I suspect a configuration issue/JCA bug if anything. Can you paste your datasource configuration in here? Are you sure you configured the datasources for XA?
Tom
-
7. Re: Jboss7.1 arjuna configuration
als Apr 9, 2012 10:21 AM (in response to tomjenkinson)Hi Tom.
All what I want is very simple pattern when one of my TimerEJbs calling other Session EJB via Local - and this Session EJB commit a JTA transaction.
Here is my datasource
<datasources>
<datasource jndi-name="java:jboss/datasources/MyDataSource" pool-name="MyDataSource" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
<driver>com.mysql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>x</user-name>
<password>y</password>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="h22" module="org.h2.Driver">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
Alexey
P.S
Its just amazing.
I tried to make a simple workaround
InitialContext initialContext = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)initialContext.lookup("java:jboss/datasources/MyDataSource");
java.sql.Connection conn = ds.getConnection();
Same crash , seems it i not connected to JTA at all.
Any suggestions?
-
8. Re: Jboss7.1 arjuna configuration
als Apr 11, 2012 4:20 AM (in response to als)I think this is a supercritical showstopper bug. How could I fill JIRA for that?
-
9. Re: Jboss7.1 arjuna configuration
mmusgrov Apr 11, 2012 4:46 AM (in response to als)Alexey S. wrote:
<datasource jndi-name="java:jboss/datasources/MyDataSource" pool-name="MyDataSource" enabled="true" use-java-context="true">
You need to be using an <xa-datasoure>
-
10. Re: Jboss7.1 arjuna configuration
als Apr 11, 2012 4:55 AM (in response to mmusgrov)but the driver is using xa-datasource- isnt it enough?
-
11. Re: Jboss7.1 arjuna configuration
als Apr 11, 2012 5:10 AM (in response to als)when could I find the xa-datasource sample for AS 7?
-
12. Re: Jboss7.1 arjuna configuration
tomjenkinson Apr 11, 2012 5:34 AM (in response to mmusgrov)Michael Musgrove wrote:
Alexey S. wrote:
<datasource jndi-name="java:jboss/datasources/MyDataSource" pool-name="MyDataSource" enabled="true" use-java-context="true">
You need to be using an <xa-datasoure>
+1
-
13. Re: Jboss7.1 arjuna configuration
tomjenkinson Apr 11, 2012 5:38 AM (in response to als)Hi Alexey,
Take a look at: https://github.com/jbossas/quickstart/blob/master/jta-crash-rec/src/main/webapp/WEB-INF/jta-crash-rec-quickstart-ds.xml
Or more generally: https://github.com/jbossas/quickstart/
e.g. jta-crash-rec
cmt (JTA with PostgreSQL)
jts
jts-distributed-crash-rec
Depending upon your needs...
Hope that helps!
Tom
-
14. Re: Jboss7.1 arjuna configuration
mmusgrov Apr 11, 2012 5:47 AM (in response to als)If you go to the web console (http://localhost:9990), select the Profile tab (top right) and from the menu on the left choose Connector -> Datasources. Choose the XA Datasources tab. Click the Add button (top right) to create an XA Datasource ...
Alternatively, you could try deploying an xxx-ds.xml file with you app by putting the ds config in the WEB-INF folder. Eg
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<xa-datasource jndi-name="java:jboss/datasources/MyDataSource" pool-name="MyDataSource" enabled="true" use-ccm="false">
<xa-datasource-property name="URL">
jdbc:mysql://localhost:3306/mydb
</xa-datasource-property>
<driver>com.mysq</driver>
<xa-pool>
<is-same-rm-override>false</is-same-rm-override>
<interleaving>false</interleaving>
<pad-xid>false</pad-xid>
<wrap-xa-resource>true</wrap-xa-resource>
</xa-pool>
<security>
<user-name>x</user-name>
<password>y</password>
</security>
<recovery>
<recover-credential>
<user-name>x</user-name>
<password>y</password>
</recover-credential>
</recovery>
</xa-datasource>
</datasources>