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:

                 org.apache.geronimo.connector.outbound.LocalXAResource@abc617d; 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. "

 

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***