|
Hi Friends,
I have the following piece of code:
Can some body explain why this fails at this statement: ‘account.addTransaction(transactionLocal); ’ (pls see the code below).
PS 1: Here in one method, we are calling two ejbs, in which the second ejb references the first ejb, Is this the problem….??? For the exception. PS 2: Is this the cause for the following exception: [EMAIL PROTECTED]; continuing with rollback javax.transaction.xa.XAException at org.apache.geronimo.connector.outbound.LocalXAResource.rollback(LocalXAResource.java:88) at org.apache.geronimo.transaction.manager.TransactionImpl.rollbackResources(TransactionImpl.java:542) at org.apache.geronimo.transaction.manager.TransactionImpl.rollback(TransactionImpl.java:446)
--------------------------------My Code--------------------------------------------------------------
public String assignToAccount(final String transactionId, final String accountId) { int count = 1; AccountDetailsLocal account = null; AccountDetailsLocalHome accountLocalHome = null; try { if (this.logger != null && this.logger.isDebugEnabled(this.loggerName)) { this.logger.debug(this.loggerName, "eneterd assign to acoount()"); this.logger.debug(this.loggerName, "account no is " + accountId); }
System.out.println("\n *** Initial (San) Test ****\n");
TransactionLocalHome transactionLocalHome = (TransactionLocalHome) this.getServiceLocator( LookUpConstants.INTIAL_CONTEXT_FACTORY.toString(), LookUpConstants.URL.toString()).getLocalHome( LookUpConstants.JNDI_TRANSACTION_EJB.toString(), TransactionLocalHome.class); TransactionLocal transactionLocal = transactionLocalHome.findByPrimaryKey(transactionId);
System.out.println("\n *** First Test ****\n");
count++; accountLocalHome = (AccountDetailsLocalHome) this.getServiceLocator( LookUpConstants.INTIAL_CONTEXT_FACTORY.toString(), LookUpConstants.URL.toString()).getLocalHome( LookUpConstants.JNDI_ACCOUNTS_EJB.toString(), AccountDetailsLocalHome.class); account = accountLocalHome.findByPrimaryKey(accountId); count++;
System.out.println("\n *** Second Test ****\n");
account.addTransaction(transactionLocal); // This fails..!!!!!!
System.out.println("\n *** Third Test ****\n");
} catch (ObjectNotFoundException oe) { if (this.logger != null && this.logger.isDebugEnabled(this.loggerName)){ this.logger.error("error while finding a account-assigntoaccount() of payeeservice ", oe); } if (count == 1){ return ("TransactionNotFound"); }else{ return ("AccountNotFound"); } } catch (FinderException fe) { fe.printStackTrace(); if (this.logger != null && this.logger.isDebugEnabled(this.loggerName)){ this.logger.error("exception in finding a transaction or account-assigntoaccount() ", fe); } throw new EJBException(fe.getMessage(), fe); } catch (Exception ex) { ex.printStackTrace(); if (this.logger != null && this.logger.isDebugEnabled(this.loggerName)){ this.logger.error("error in finding a transaction or account-assigntoaccount() ", ex); } throw new EJBException(ex.getMessage(), ex); } return ("Success"); } ------------------------------My Code----------------------------------------------------------------
Thanks, Santosh. "Don't talk about yourself; it will be done when you leave. "
|
