Hi,
I am trying to understand how a transacted MDB would work with JBoss. In
essence, I have defined an Oracle XA Datasource. What I would like to do is
receive a message from a queue, insert the data into a table and reply on a
different queue.
I am trying to manage the transaction myself, i.e.,
onMessage(..) {
TopicConnection tconnection = null;
TopicSession tsession = null;
Connection dbConn = null;
UserTransaction utx = null;
try {
utx = super.getMessageDrivenContext().getUserTransaction();
utx.begin();
dbConn = dataSource.getConnection();
MapMessage mapMsg = (MapMessage) message;
...
// Get details and insert into table
.....
// Send a message to Active MQ
tconnection = ((TopicConnectionFactory) factory)
.createTopicConnection();
tsession = (TopicSession) tconnection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = tsession.createProducer(destination);
tconnection.start();
TextMessage rep = tsession.createTextMessage();
rep.setText("Transaction completed...............");
producer.send(rep);
utx.commit();
} catch (Exception e) {
if (utx != null) {
try {
utx.rollback();
} catch (IllegalStateException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SystemException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
e.printStackTrace();
} finally {
if (dbConn != null) {
try {
dbConn.close();
} catch (Exception e) {
}
}
}
When I run the code, I am getting the following error. Any tips would be
greately appreciated. I dont really have any plugins defined in my
brokerConfig.xml. Why is the code trying to authenticate? What do I need to
provide to pass the authentication? My code pretty much is based of the
panaycadb example.
20:48:58,031 ERROR [STDERR] java.lang.SecurityException: Invalid
authentication
attempt, principal=null
20:48:58,031 ERROR [STDERR] at
org.jboss.resource.connectionmanager.BaseConn
ectionManager2.getSubject(BaseConnectionManager2.java:589)
20:48:58,031 ERROR [STDERR] at
org.jboss.resource.connectionmanager.BaseConn
ectionManager2.allocateConnection(BaseConnectionManager2.java:395)
20:48:58,031 ERROR [STDERR] at
org.jboss.resource.connectionmanager.BaseConn
ectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.
java:842)
20:48:58,031 ERROR [STDERR] at
org.apache.activemq.ra.ActiveMQConnectionFact
ory.createConnection(ActiveMQConnectionFactory.java:91)
20:48:58,031 ERROR [STDERR] at
org.apache.activemq.ra.ActiveMQConnectionFact
ory.createConnection(ActiveMQConnectionFactory.java:64)
--
View this message in context:
http://www.nabble.com/Transacted-MDB-with-JBoss-tp14826286s2354p14826286.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.