Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Modifying message before rolling back transaction

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a requirement where error information needs to be added to a message in case if there are any error in message processing .
In case of errors I am rolling back the transaction and understand that due to this the message cannot be modified .
so I tried to make the changes in the message in a method which has transaction attribute as NOT_SUPPORTED , as this should suspend the transaction
and allow changes in the message .
However I get below exception while trying to do this .

javax.jms.MessageNotWriteableException: MQJMS0008: JMS Client attempts to write a read-only message
at com.ibm.jms.JMSMessage.newMessageNotWriteableException(JMSMessage.java:5055)
at com.ibm.jms.JMSMessage.setStringProperty(JMSMessage.java:6148)
at com.bskyb.finance.api.EJB.mdbs.APIFFMessageRouterMDBBean.updateHeaderAttributes(APIFFMessageRouterMDBBean.java:159)
at com.bskyb.finance.api.EJB.mdbs.APIFFMessageRouterMDBBean.onMessage(APIFFMessageRouterMDBBean.java:121)
at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:302)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:271)
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:240)
at com.ibm.mq.jms.MQSession.run(MQSession.java:1695)
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:975)
at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:987)
at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:675)
at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:642)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:96)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:132)
at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:500)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)

I could not figure out any property named readOnly in ByteMessage , not sure if the approach I have taken is correct , may be I have missed some
basic stuff .
Please help .

Thanks and Regards,
Chiku
 
    Bookmark Topic Watch Topic
  • New Topic