PDA

View Full Version : Integration JBoss with JackRabbit and SpringModules



junglika
Sep 22nd, 2006, 12:00 PM
Hello.

I am trying to run jackrabbit in a transactional environment such as
jboss because i need JTA Transaction(i'm working with DataBase and jackrabbit in the same transaction). The application server was configured more or less as described in http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss




- removed jcr-1.0.jar from jackrabbit-jca-1.0.1.rar
- download the latest jcr-1.0.1.jar and copied it to the
jboss/server/${profile}/lib folder
- copied the modified jackrabbit-jca-1.0.1.rar to
jboss/server/${profile}/deploy
- adjusted jcr-ds.xml to jackrabbit-jca-1.0.1.rar
(<rar-name>jackrabbit-jca-1.0.1.rar</rar-name>) as well as
homeDir and configFile
- copied the modified jcr-ds.xml also to the
jboss/server/${profile}/deploy folder




<connection-factories>
<tx-connection-factory>
<jndi-name>jcr/local</jndi-name>
<xa-transaction/>
<rar-name>jackrabbit-jca-1.0.1.rar</rar-name>
<connection-definition>javax.jcr.Repository</connection-definition>
<config-property name="homeDir" type="java.lang.String">/tmp/jackrabbit</config-property>
<config-property name="configFile" type="java.lang.String">/tmp/repository.xml</config-property>
</tx-connection-factory>
</connection-factories>


I use springmodules 0.5 and use DAO support to acces to repository, when jboss try to make a commit throw the next Exception:



2006-07-20 15:41:52,824 ERROR [org.apache.jackrabbit.core.XASessionImpl]
Resource not associated with a transaction.
2006-07-20 15:41:52,825 WARN [org.jboss.tm.TransactionImpl]
XAException: tx=TransactionImpl:XidImpl[FormatId=257,
GlobalId=brenner/16, BranchQual=, localId=16] errorCode=XAER_PROTO
javax.transaction.xa.XAException
at org.apache.jackrabbit.core.XASessionImpl.end(XASes sionImpl.java:288)
at
org.jboss.tm.TransactionImpl$Resource.endResource( TransactionImpl.java:2138)
at
org.jboss.tm.TransactionImpl$Resource.endResource( TransactionImpl.java:2113)
at org.jboss.tm.TransactionImpl.endResources(Transact ionImpl.java:1459)
at org.jboss.tm.TransactionImpl.beforePrepare(Transac tionImpl.java:1113)
at org.jboss.tm.TransactionImpl.commit(TransactionImp l.java:321)
at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPol icy.java:175)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPoli cy.java:87)
at

I have no idea how this can be done. Any ideas? :confused: Did any get jackrabbit running in JBoss whith springmodules-jcr-0.5.jar and jackrabbit-jca-1.0.1.rar????

Thanks

Jorge Rodríguez Pedrianes

Costin Leau
Sep 25th, 2006, 03:21 AM
I guess you'll find more answers on the Jackrabbit mailing list; SM Jcr support support doesn't handle transactions when dealing with JCA (as you can see from the stracktrace).
If you find any answers, please post back - it might help others.

junglika
Oct 5th, 2006, 11:56 AM
The problem appears when the spring-modules library does a session logout. I sended a patch to jackrabbit jira to disable this method, because the session must be closed when transaction finishes.

Costin Leau
Oct 8th, 2006, 05:13 AM
Let me know what the outcome is - we could add some workaround maybe inside the JCR module to prevent the problem from occuring.
You could also raise an issue on JIRA for further reference.
Thanks!

junglika
Oct 16th, 2006, 03:54 AM
Hello again :rolleyes:

I had seen that in days ago appear a new version of jackrabbit, but not include the modification that i considerer that is good.

See
https://issues.apache.org/jira/browse/JCR-463

The Spring modules fail when in "releaseSession" method (SessionFactoryUtils) invoke a "session.logou()" in jca transaction:

public static void releaseSession(Session session, SessionFactory sessionFactory) {
if (session == null) {
return;
}
// Only close non thread bound Sessions.
if (!isSessionThreadBound(session, sessionFactory)) {
logger.debug("Closing JCR Session");
session.logout();
}
}

The isSessionThreadBound method don't know if i use jca transaction.

I think that this the error but if in jackrabbit library no change de code in springmodules a don't know that make.

Thanks

Costin Leau
Oct 17th, 2006, 02:38 PM
can you please create an issue on JIRA? it's a lot easier to keep track of these problems.
Thanks.

junglika
Oct 17th, 2006, 03:17 PM
where do you think that i must create a issue, in jackrabbit or in springframework, (i add a new issue in jackrabbit days ago, see: https://issues.apache.org/jira/browse/JCR-593)

Costin Leau
Oct 17th, 2006, 03:40 PM
If you'd like the workaround to be implemented inside Spring Modules, then the Spring Modules JIRA.