Skip to main content

Smpp RA and Persistence RA

2 replies [Last post]
eshevchenko
Offline
Joined: 2008-06-10

Hi

XAException, when i try to send sms and save data in database:

public void onSendSMS(SMSRobotEvent event, ActivityContextInterface aci) {

String DestinationAddress = event.getPhoneNumber();
String SourceAddress = event.getSourceNumber();
String textSMS = event.getSmsTextMessage();
String MessageId = event.getMessageId();
logger.debug("Try to send message. MessageId:" + MessageId);
Dialog dialog = smppProvider.getDialog(DestinationAddress, "0020");
ShortMessage sms = dialog.createMessage();
sms.setText(textSMS);
sms.setOriginator(SourceAddress);
ClientTransaction tx = dialog.createSubmitSmTransaction();
try {
ActivityContextInterface ac1 = smppAcif.getActivityContextInterface(tx);
ac1.attach(sbbContext.getSbbLocalObject());

} catch (FactoryException ex) {
ex.printStackTrace();
logger.error("Could not create clent transaction with SMSC.");
} catch (NullPointerException ex) {
ex.printStackTrace();
logger.error("Could not create clent transaction with SMSC.");
} catch (UnrecognizedActivityException ex) {
ex.printStackTrace();
logger.error("Could not create clent transaction with SMSC.");
}
int activ_id = -1;
try {

tx.send(sms);
activ_id = tx.getId();
logger.debug("Message was sended. Active id:"+activ_id+". MessageId:" + MessageId);
} catch (IOException ex) {
ex.printStackTrace();
logger.error("Could not send message. MessageId:" + MessageId);
}
Query upQuery = null;

EntityManager mgr= this.persistenceResourceAdaptorSbbInterface.createEntityManager(new HashMap(), "custom-pu");
try
{
System.out.println("---------2");
upQuery = mgr.createQuery("update t_messages set temp_send_id=:activ_id, status_id = :status_id where id=:message_id");
Long mid = new Long(MessageId);
upQuery.setParameter("message_id", mid);
upQuery.setParameter("activ_id", activ_id);
upQuery.setParameter("status_id", TryToSendMessageStatus);
upQuery.executeUpdate();
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Error --- " + e.getMessage());
logger.error("Could not update state. MessageId:" + MessageId);
}

mgr.close();
logger.debug("Message status was succefuly updated. Active id:"+activ_id+". MessageId:" + MessageId);

}

EXception:

2008-07-04 10:49:10,493 INFO [STDOUT] 10:49:10,493 INFO [XACacheXAManager] Failed to commit XACache writes in tx[TransactionImple < ac, BasicAction: -53e1f5f6:915:486dd5cc:f7 status: ActionStatus.COMMITTING >.
Reason: Entry version verification failed for Map[runtimeCache-activitycontext:1fd769092b384590:1aa574e7:11aed0b257f:-7fca].
Reason: Committing entry is not newer version than the actual entry's version.
entry key[acState]
committing entry version[0]
committing entry value[Active Activity Context]
actual entry version[1].
actual entry value[Ending Activity Context]
2008-07-04 10:49:10,509 WARN [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.resources.arjunacore.commitxaerror] [com.arjuna.ats.internal.jta.resources.arjunacore.commitxaerror] XAResourceRecord.commit - xa error XAException.XA_HEURRB
2008-07-04 10:49:10,556 DEBUG [org.hibernate.ejb.EntityManagerImpl] Closing entity manager after transaction completion
2008-07-04 10:49:10,556 WARN [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_4] TwoPhaseCoordinator.afterCompletion - returned failure for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@85ce5a
2008-07-04 10:49:10,556 INFO [STDOUT] 10:49:10,556 ERROR [EventRouterImpl] Unhandled Exception in event router:
javax.transaction.SystemException: Failed to commit tx. null
at org.mobicents.slee.runtime.transaction.TransactionManagerImpl.commit(TransactionManagerImpl.java:349)
at org.mobicents.slee.runtime.EventRouterImpl.routeQueuedEvent(EventRouterImpl.java:1063)
at org.mobicents.slee.runtime.EventRouterImpl.access$100(EventRouterImpl.java:64)
at org.mobicents.slee.runtime.EventRouterImpl$EventExecutor.run(EventRouterImpl.java:121)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)

HELP please.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
baranowb
Offline
Joined: 2006-01-09

Hmm doesnt say much. Could You send me src with build?

eshevchenko
Offline
Joined: 2008-06-10

Yes. my email sh_ev_a@ukr.net. send me test email and i reply with src in attachment