[jboss-user] [JBoss Messaging] - Re: Help on MessagingXAException
busawreck
do-not-reply at jboss.com
Mon Nov 27 11:55:45 EST 2006
Here comes what my code looks like, kind of anyway, exception handling omitted. I've run the same test setup 4 more times, but I only got the error once more.
@Stateless
public SenderBean implements Sender {
Connection con = null;
public void send(Serializable obj, String destination) {
Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
InitialContext ctx = new InitialContext();
Destination destination = (Destination) ctx.lookup(destination);
MessageProducer producer = session.createProducer(destination);
ObjectMessage objMsg = session.createObjectMessage(obj);
producer.send(objMsg);
session.close();
}
@Postconstruct
public void init() {
InitialContext ctx = new InitialContext();
ConnectionFactory tcf = (ConnectionFactory) ctx.lookup("java:/JmsXA");
con = tcf.createConnection();
}
@PreDestroy
public void destroy() {
con.close();
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988955#3988955
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988955
More information about the jboss-user
mailing list