Hello ranchers, Urgent info needed:- I am facing a problem with mesage driven bean. WTRN0063E: An illegal attempt to commit a one phase capable resource with existing two phase capable resources has occurred. Code in onMessageBean of MDB is:- It reads from MQ using JMS and inserts into the database. Any inputs will be of great help. Code:-
/** * getMessageDrivenContext */ public javax.ejb.MessageDrivenContext getMessageDrivenContext() { return fMessageDrivenCtx; } /** * setMessageDrivenContext */ public void setMessageDrivenContext(javax.ejb.MessageDrivenContext ctx) { fMessageDrivenCtx = ctx; } /** * ejbCreate */ public void ejbCreate() { System.out.println(" In SimpleMessageBean ejbCreate"); } /** * onMessage */ public void onMessage(javax.jms.Messagemsg) {
try {
System.out.println("In On Message");
System.out.println("Message Received Poonam"+msg);
System.out.println("Message id is "+msg.getJMSMessageID()); String strMessageId=new String(msg.getJMSMessageID()); System.out.println("Message id new String strMessageId is "+ strMessageId); strMessageId=msg.getJMSMessageID().getBytes().toString(); System.out.println("Message id strMessageId bytes to string"+new String (strMessageId.getBytes())); TextMessage txtmsg=(TextMessage)msg; System.out.println("This is text message"+txtmsg.getText()); dbConfiguration(txtmsg.getJMSMessageID(),txtmsg.getJMSCorrelationID(),"",txtmsg.getText()); System.out.println("Leaving onMessage method");
catch (Exception ex) { ex.printStackTrace(); throw new Exception("Unable to load JDBC driver: " + jndiName);
}
System.out.println("Leaving " + _method);
return ds; } /** * ejbRemove*/ public void ejbRemove() { System.out.println(" In SimpleMessageBean ejbRemove"); }
/** * Get a connection. Handle the IBM Websphere StaleConnectionException. * If the db has been restarted, the connections in WebSphere's pool may * be invalid. There is no way to know until they are used, but at that * point a StaleConnectionException is thrown and WAS refreshes the pool. * The next attempt to get a connection should get a good one. * * @return Connection * @throws SQLException If there is problem getting connection. */ private Connection getDBConnection() throws SQLException {
Could you let me know the driver/datasource classes used. The problem is occuring because you are trying to do a 2 Phase Commit transactions using non-XA drivers. Check if your drivers for messaging and database are XA compliant.