Hi, i have a broker with user authentication. The users cannot create an
specific topic. When i try to create this topic, a securityException is
logged, but it is not thrown. I need to catch this exception to do a
rollback on my transaction. This is the code that does not throw the
exception:

        ActiveMQXAConnectionFactory xaFactory = new
ActiveMQXAConnectionFactory(user, password, activeMQUri);

        XAConnection conn=xaFactory.createXAConnection();
        conn.start();
        XASession session=conn.createXASession();

        session.createProducer(session.createTopic("topic"));

This is code throws the exception when the producer is created, but is not
usefull because i need to enlist the transaction:

         ActiveMQConnectionFactory connfact=new
ActiveMQConnectionFactory(user, password, activeMQUri);
         Connection conn=connfact.createConnection();
         conn.start();
         Session ses=conn.createSession(true, 0);
         ses.createProducer(session.createTopic("topic"));

And this is the exception:

layout.ConversionPattern=2010-02-03 10:50:27,028 [VMTransport] [] WARN 
org.apache.activemq.broker.TransportConnection.Service  - Async error
occurred: java.lang.SecurityException: User user is not authorized to write
to: topic://topic
java.lang.SecurityException: User user is not authorized to write to:
topic://topic
        at
org.apache.activemq.security.AuthorizationBroker.addProducer(AuthorizationBroker.java:153)
        at
org.apache.activemq.broker.MutableBrokerFilter.addProducer(MutableBrokerFilter.java:97)
        at
org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:491)
        at org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:105)
        at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:297)
        at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:175)
        at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:109)
        at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
        at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:205)
        at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
        at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

The only way to catch the exception is using the ExceptionListener, this is
not an option because of the async nature of the listener. I need the
exception when the creation fails to rollback y transaction.

Any idea what can be happening?

Thanks
Javier
-- 
View this message in context: 
http://old.nabble.com/Exceptions-are-not-thrown-on-XA-Enviroment-tp27437336p27437336.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to