You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Holger <si...@googlemail.com> on 2010/07/28 12:21:38 UTC

JMS Transactions not handling SecurityException?

Hi,

I have the following (very basic) route, which should be transactional
(i.e., if a message is consumed from foo it must be placed in bar2!):

from("activemq:queue:foo")
                        .transacted()
                        .to("activemq:queue:bar2");

Here, foo is accessible by the user but bar2 is not accessible. 

I send a message to the queue with:

template.sendBody("activemq:queue:foo", "Hello World");

Then, I get the following output:

DEBUG DefaultMessageListenerContainer-1
org.apache.camel.component.jms.EndpointMessageListener -
Endpoint[activemq://queue:foo] consumer receiving JMS message:
ActiveMQTextMessage {commandId = 6, responseRequired = false, messageId =
ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1, originalDestination = null,
originalTransactionId = null, producerId =
ID:HOLGERSNB-2175-1280308413512-2:61:1:1, destination = queue://foo,
transactionId = TX:ID:HOLGERSNB-2175-1280308413512-2:61:1, expiration = 0,
timestamp = 1280308435389, arrival = 0, brokerInTime = 1280308435389,
brokerOutTime = 1280308435405, correlationId = null, replyTo = null,
persistent = true, type = null, priority = 4, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1039, properties = null, readOnlyProperties = true, readOnlyBody =
true, droppable = false, text = Hello World}
DEBUG DefaultMessageListenerContainer-1
org.apache.camel.spring.spi.TransactionErrorHandler - Transaction begin
(0x1ca1837) for ExchangeId: ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1
DEBUG DefaultMessageListenerContainer-1
org.apache.camel.processor.SendProcessor - >>>>
Endpoint[activemq://queue:bar2] Exchange[JmsMessage: ActiveMQTextMessage
{commandId = 6, responseRequired = false, messageId =
ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1, originalDestination = null,
originalTransactionId = null, producerId =
ID:HOLGERSNB-2175-1280308413512-2:61:1:1, destination = queue://foo,
transactionId = TX:ID:HOLGERSNB-2175-1280308413512-2:61:1, expiration = 0,
timestamp = 1280308435389, arrival = 0, brokerInTime = 1280308435389,
brokerOutTime = 1280308435405, correlationId = null, replyTo = null,
persistent = true, type = null, priority = 4, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1039, properties = null, readOnlyProperties = true, readOnlyBody =
true, droppable = false, text = Hello World}]
DEBUG DefaultMessageListenerContainer-1
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate - Executing
callback on JMS Session: ActiveMQSession
{id=ID:HOLGERSNB-2175-1280308413512-2:64:1,started=false}
WARN VMTransport org.apache.activemq.broker.TransportConnection.Service -
Async error occurred: java.lang.SecurityException: User user is not
authorized to write to: queue://bar2
java.lang.SecurityException: User user is not authorized to write to:
queue://bar2
	at
org.apache.activemq.security.AuthorizationBroker.addProducer(AuthorizationBroker.java:159)
	at
org.apache.activemq.broker.MutableBrokerFilter.addProducer(MutableBrokerFilter.java:97)
	at
org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:494)
	at org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:105)
	at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300)
	at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
	at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)
	at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
	at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210)
	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(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
DEBUG DefaultMessageListenerContainer-1
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate - Sending
JMS message to: queue://bar2 with message: ActiveMQTextMessage {commandId =
0, responseRequired = false, messageId = null, originalDestination = null,
originalTransactionId = null, producerId = null, destination = null,
transactionId = null, expiration = 0, timestamp = 0, arrival = 0,
brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null,
persistent = true, type = null, priority = 4, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 0, properties = {CamelJmsDeliveryMode=2}, readOnlyProperties =
false, readOnlyBody = false, droppable = false, text = Hello World}
WARN VMTransport org.apache.activemq.broker.TransportConnection.Service -
Async error occurred: java.lang.SecurityException: User user is not
authorized to write to: queue://bar2
java.lang.SecurityException: User user is not authorized to write to:
queue://bar2
	at
org.apache.activemq.security.AuthorizationBroker.send(AuthorizationBroker.java:182)
	at
org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:133)
	at
org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:446)
	at
org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:631)
	at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300)
	at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
	at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)
	at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
	at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210)
	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(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
DEBUG DefaultMessageListenerContainer-1
org.apache.camel.spring.spi.TransactionErrorHandler - Transaction commit
(0x1ca1837) for ExchangeId: ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1
WARN VMTransport org.apache.activemq.broker.TransportConnection.Service -
Async error occurred: java.lang.IllegalStateException: Cannot remove a
producer that had not been registered:
ID:HOLGERSNB-2175-1280308413512-2:64:1:1
java.lang.IllegalStateException: Cannot remove a producer that had not been
registered: ID:HOLGERSNB-2175-1280308413512-2:64:1:1
	at
org.apache.activemq.broker.TransportConnection.processRemoveProducer(TransportConnection.java:515)
	at org.apache.activemq.command.RemoveInfo.visit(RemoveInfo.java:78)
	at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300)
	at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
	at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)
	at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
	at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210)
	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(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
INFO DefaultMessageListenerContainer-1
org.springframework.jms.listener.DefaultMessageListenerContainer - Setup of
JMS message listener invoker failed for destination 'bar2' - trying to
recover. Cause: User user is not authorized to read from: queue://bar2
INFO DefaultMessageListenerContainer-1
org.springframework.jms.listener.DefaultMessageListenerContainer -
Successfully refreshed JMS Connection
INFO DefaultMessageListenerContainer-2
org.springframework.jms.listener.DefaultMessageListenerContainer - Setup of
JMS message listener invoker failed for destination 'bar2' - trying to
recover. Cause: User user is not authorized to read from: queue://bar2
INFO DefaultMessageListenerContainer-2
org.springframework.jms.listener.DefaultMessageListenerContainer -
Successfully refreshed JMS Connection

The problem is that the message is consumed from the foo-queue and not
rolled back within the transaction (the transaction seems to commit before
sending the message to the bar-queue).

Is there anything I am doing wrong?

Thanks,
Holger
-- 
View this message in context: http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2256668.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JMS Transactions not handling SecurityException?

Posted by Claus Ibsen <cl...@gmail.com>.
BTW

I have created a ticket to see if we can do something in Camel to make
it react to those security exceptions
https://issues.apache.org/activemq/browse/CAMEL-3017


On Fri, Jul 30, 2010 at 2:26 PM, Holger <si...@googlemail.com> wrote:
>
> I forwarded my question to activemq-user:
> http://old.nabble.com/SecurityException-not-delegated-to-Camel--tp29305408p29305408.html
>
> Thanks,
> Holger
>
>
> Claus Ibsen-2 wrote:
>>
>> On Fri, Jul 30, 2010 at 1:26 PM, Holger <si...@googlemail.com> wrote:
>>>
>>> Hi Claus,
>>>
>>> Thanks for your answer.
>>>
>>> Yet, I know how to configure Active MQ and really intended to have no
>>> access
>>> to the queue bar2 as a test case.
>>>
>>> I assumed that Camel would rollback the transaction in this case but
>>> unfortunately it does not:
>>>
>>
>> I think this is happening in a lower layer in the JMS broker. You most
>> likely need to address this at AMQ and hear how it reacts and whats
>> the normal behavior.
>>
>> Camel *just* uses Spring JMS when you do from("jms") and uses Spring
>> TransactionManager. And if an exception is thrown it will rethrow that
>> as a RuntimeException back to Spring JMS and hence it will rollback.
>>
>> So the issue is in the JMS broker and how it enforces this security.
>>
>>
>>> On Wed, Jul 28, 2010 at 12:21 PM, Holger wrote:
>>>>
>>>> [...]
>>>>
>>>> The problem is that the message is consumed from the foo-queue and not
>>>> rolled back within the transaction (the transaction seems to commit
>>>> before
>>>> sending the message to the bar-queue).
>>>
>>> Thanks,
>>> Holger
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2259428.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2259470.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: JMS Transactions not handling SecurityException?

Posted by Holger <si...@googlemail.com>.
I forwarded my question to activemq-user:
http://old.nabble.com/SecurityException-not-delegated-to-Camel--tp29305408p29305408.html

Thanks,
Holger


Claus Ibsen-2 wrote:
> 
> On Fri, Jul 30, 2010 at 1:26 PM, Holger <si...@googlemail.com> wrote:
>>
>> Hi Claus,
>>
>> Thanks for your answer.
>>
>> Yet, I know how to configure Active MQ and really intended to have no
>> access
>> to the queue bar2 as a test case.
>>
>> I assumed that Camel would rollback the transaction in this case but
>> unfortunately it does not:
>>
> 
> I think this is happening in a lower layer in the JMS broker. You most
> likely need to address this at AMQ and hear how it reacts and whats
> the normal behavior.
> 
> Camel *just* uses Spring JMS when you do from("jms") and uses Spring
> TransactionManager. And if an exception is thrown it will rethrow that
> as a RuntimeException back to Spring JMS and hence it will rollback.
> 
> So the issue is in the JMS broker and how it enforces this security.
> 
> 
>> On Wed, Jul 28, 2010 at 12:21 PM, Holger wrote:
>>>
>>> [...]
>>>
>>> The problem is that the message is consumed from the foo-queue and not
>>> rolled back within the transaction (the transaction seems to commit
>>> before
>>> sending the message to the bar-queue).
>>
>> Thanks,
>> Holger
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2259428.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2259470.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JMS Transactions not handling SecurityException?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jul 30, 2010 at 1:26 PM, Holger <si...@googlemail.com> wrote:
>
> Hi Claus,
>
> Thanks for your answer.
>
> Yet, I know how to configure Active MQ and really intended to have no access
> to the queue bar2 as a test case.
>
> I assumed that Camel would rollback the transaction in this case but
> unfortunately it does not:
>

I think this is happening in a lower layer in the JMS broker. You most
likely need to address this at AMQ and hear how it reacts and whats
the normal behavior.

Camel *just* uses Spring JMS when you do from("jms") and uses Spring
TransactionManager. And if an exception is thrown it will rethrow that
as a RuntimeException back to Spring JMS and hence it will rollback.

So the issue is in the JMS broker and how it enforces this security.


> On Wed, Jul 28, 2010 at 12:21 PM, Holger wrote:
>>
>> [...]
>>
>> The problem is that the message is consumed from the foo-queue and not
>> rolled back within the transaction (the transaction seems to commit before
>> sending the message to the bar-queue).
>
> Thanks,
> Holger
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2259428.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: JMS Transactions not handling SecurityException?

Posted by Holger <si...@googlemail.com>.
Hi Claus,

Thanks for your answer.

Yet, I know how to configure Active MQ and really intended to have no access
to the queue bar2 as a test case. 

I assumed that Camel would rollback the transaction in this case but
unfortunately it does not:

On Wed, Jul 28, 2010 at 12:21 PM, Holger wrote:
>
> [...]
>
> The problem is that the message is consumed from the foo-queue and not
> rolled back within the transaction (the transaction seems to commit before
> sending the message to the bar-queue).

Thanks,
Holger

-- 
View this message in context: http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2259428.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JMS Transactions not handling SecurityException?

Posted by Claus Ibsen <cl...@gmail.com>.
Look at AMQ about security.

You most likely need to configure the activemq component with a valid
username/password which has permission to send messages.


On Wed, Jul 28, 2010 at 12:21 PM, Holger <si...@googlemail.com> wrote:
>
> Hi,
>
> I have the following (very basic) route, which should be transactional
> (i.e., if a message is consumed from foo it must be placed in bar2!):
>
> from("activemq:queue:foo")
>                        .transacted()
>                        .to("activemq:queue:bar2");
>
> Here, foo is accessible by the user but bar2 is not accessible.
>
> I send a message to the queue with:
>
> template.sendBody("activemq:queue:foo", "Hello World");
>
> Then, I get the following output:
>
> DEBUG DefaultMessageListenerContainer-1
> org.apache.camel.component.jms.EndpointMessageListener -
> Endpoint[activemq://queue:foo] consumer receiving JMS message:
> ActiveMQTextMessage {commandId = 6, responseRequired = false, messageId =
> ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:HOLGERSNB-2175-1280308413512-2:61:1:1, destination = queue://foo,
> transactionId = TX:ID:HOLGERSNB-2175-1280308413512-2:61:1, expiration = 0,
> timestamp = 1280308435389, arrival = 0, brokerInTime = 1280308435389,
> brokerOutTime = 1280308435405, correlationId = null, replyTo = null,
> persistent = true, type = null, priority = 4, groupID = null, groupSequence
> = 0, targetConsumerId = null, compressed = false, userID = null, content =
> null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
> 0, size = 1039, properties = null, readOnlyProperties = true, readOnlyBody =
> true, droppable = false, text = Hello World}
> DEBUG DefaultMessageListenerContainer-1
> org.apache.camel.spring.spi.TransactionErrorHandler - Transaction begin
> (0x1ca1837) for ExchangeId: ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1
> DEBUG DefaultMessageListenerContainer-1
> org.apache.camel.processor.SendProcessor - >>>>
> Endpoint[activemq://queue:bar2] Exchange[JmsMessage: ActiveMQTextMessage
> {commandId = 6, responseRequired = false, messageId =
> ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:HOLGERSNB-2175-1280308413512-2:61:1:1, destination = queue://foo,
> transactionId = TX:ID:HOLGERSNB-2175-1280308413512-2:61:1, expiration = 0,
> timestamp = 1280308435389, arrival = 0, brokerInTime = 1280308435389,
> brokerOutTime = 1280308435405, correlationId = null, replyTo = null,
> persistent = true, type = null, priority = 4, groupID = null, groupSequence
> = 0, targetConsumerId = null, compressed = false, userID = null, content =
> null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
> 0, size = 1039, properties = null, readOnlyProperties = true, readOnlyBody =
> true, droppable = false, text = Hello World}]
> DEBUG DefaultMessageListenerContainer-1
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate - Executing
> callback on JMS Session: ActiveMQSession
> {id=ID:HOLGERSNB-2175-1280308413512-2:64:1,started=false}
> WARN VMTransport org.apache.activemq.broker.TransportConnection.Service -
> Async error occurred: java.lang.SecurityException: User user is not
> authorized to write to: queue://bar2
> java.lang.SecurityException: User user is not authorized to write to:
> queue://bar2
>        at
> org.apache.activemq.security.AuthorizationBroker.addProducer(AuthorizationBroker.java:159)
>        at
> org.apache.activemq.broker.MutableBrokerFilter.addProducer(MutableBrokerFilter.java:97)
>        at
> org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:494)
>        at org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:105)
>        at
> org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300)
>        at
> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
>        at
> org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)
>        at
> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
>        at
> org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210)
>        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(Unknown Source)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>        at java.lang.Thread.run(Unknown Source)
> DEBUG DefaultMessageListenerContainer-1
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate - Sending
> JMS message to: queue://bar2 with message: ActiveMQTextMessage {commandId =
> 0, responseRequired = false, messageId = null, originalDestination = null,
> originalTransactionId = null, producerId = null, destination = null,
> transactionId = null, expiration = 0, timestamp = 0, arrival = 0,
> brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null,
> persistent = true, type = null, priority = 4, groupID = null, groupSequence
> = 0, targetConsumerId = null, compressed = false, userID = null, content =
> null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
> 0, size = 0, properties = {CamelJmsDeliveryMode=2}, readOnlyProperties =
> false, readOnlyBody = false, droppable = false, text = Hello World}
> WARN VMTransport org.apache.activemq.broker.TransportConnection.Service -
> Async error occurred: java.lang.SecurityException: User user is not
> authorized to write to: queue://bar2
> java.lang.SecurityException: User user is not authorized to write to:
> queue://bar2
>        at
> org.apache.activemq.security.AuthorizationBroker.send(AuthorizationBroker.java:182)
>        at
> org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:133)
>        at
> org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:446)
>        at
> org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:631)
>        at
> org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300)
>        at
> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
>        at
> org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)
>        at
> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
>        at
> org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210)
>        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(Unknown Source)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>        at java.lang.Thread.run(Unknown Source)
> DEBUG DefaultMessageListenerContainer-1
> org.apache.camel.spring.spi.TransactionErrorHandler - Transaction commit
> (0x1ca1837) for ExchangeId: ID:HOLGERSNB-2175-1280308413512-2:61:1:1:1
> WARN VMTransport org.apache.activemq.broker.TransportConnection.Service -
> Async error occurred: java.lang.IllegalStateException: Cannot remove a
> producer that had not been registered:
> ID:HOLGERSNB-2175-1280308413512-2:64:1:1
> java.lang.IllegalStateException: Cannot remove a producer that had not been
> registered: ID:HOLGERSNB-2175-1280308413512-2:64:1:1
>        at
> org.apache.activemq.broker.TransportConnection.processRemoveProducer(TransportConnection.java:515)
>        at org.apache.activemq.command.RemoveInfo.visit(RemoveInfo.java:78)
>        at
> org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:300)
>        at
> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:178)
>        at
> org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)
>        at
> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
>        at
> org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:210)
>        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(Unknown Source)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>        at java.lang.Thread.run(Unknown Source)
> INFO DefaultMessageListenerContainer-1
> org.springframework.jms.listener.DefaultMessageListenerContainer - Setup of
> JMS message listener invoker failed for destination 'bar2' - trying to
> recover. Cause: User user is not authorized to read from: queue://bar2
> INFO DefaultMessageListenerContainer-1
> org.springframework.jms.listener.DefaultMessageListenerContainer -
> Successfully refreshed JMS Connection
> INFO DefaultMessageListenerContainer-2
> org.springframework.jms.listener.DefaultMessageListenerContainer - Setup of
> JMS message listener invoker failed for destination 'bar2' - trying to
> recover. Cause: User user is not authorized to read from: queue://bar2
> INFO DefaultMessageListenerContainer-2
> org.springframework.jms.listener.DefaultMessageListenerContainer -
> Successfully refreshed JMS Connection
>
> The problem is that the message is consumed from the foo-queue and not
> rolled back within the transaction (the transaction seems to commit before
> sending the message to the bar-queue).
>
> Is there anything I am doing wrong?
>
> Thanks,
> Holger
> --
> View this message in context: http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2256668.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: JMS Transactions not handling SecurityException?

Posted by Holger <si...@googlemail.com>.
Hi Ashwin,

Thanks for your quick reply. I know this link but unfortunately I cannot
figure out what I am doing wrong.

Actually, I enhanced the JmsToJmsTransactedTest class from the camel source
and did not make any strong changes to the corresponding
JmsToJmsTransactedTest.xml file (I just changed the broker URL and user /
pass). 

Here is the code I changed / added:

XML:

<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL"
			value="vm://localhost?brokerConfig=xbean:activemq.xml" />
		<property name="userName" value="user" />
		<property name="password" value="password" />
	</bean>

Java:

@Test
    public void testJmsToJmsTestRollbackDueToSecurityException() throws
Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("activemq:queue:foo")
                        .transacted()
                        .to("mock:start")
                        .to("activemq:queue:bar2");

                from("activemq:queue:bar2").to("log:bar").to("mock:bar");
            }
        });
        context.start();

        MockEndpoint bar = getMockEndpoint("mock:bar");
        bar.expectedMessageCount(0);

        MockEndpoint start = getMockEndpoint("mock:start");
        start.expectedMessageCount(6); // default number of redeliveries by
AMQ

        template.sendBody("activemq:queue:foo", "Hello World");

        assertMockEndpointsSatisfied();
    }

Still, I get the described behaviour (with Camel 2.3.0 and 2.4.0).

Do you have any idea,what I could be doing wrong?

Thanks,
Holger
-- 
View this message in context: http://camel.465427.n5.nabble.com/JMS-Transactions-not-handling-SecurityException-tp2256668p2256718.html
Sent from the Camel - Users mailing list archive at Nabble.com.