You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by praveenbillampati <pr...@gmail.com> on 2013/04/12 15:28:31 UTC

Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

Any ideas..?



--
View this message in context: http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730768.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

Posted by Magnus Palmér <ma...@gmail.com>.
I have to do other things for a while, got as far as creating an ActiveMQ
config that does not allow creation of new queue destinations on the fly.
Using this with an invalid replyTo in the endpoint configuration of the
producer template causes the infinite retries (every 5 seconds) as
described in this thread earlier.
(I do have the a complete JUnit test for it, but no resolution of it yet,
not sure what the behavior should be.)
Setting an invalid reply queue with this setup results in:
2013-04-15 18:22:51,655 [nsumer[REQUEST]] WARN  EndpointMessageListener
   - Execution of JMS message listener failed. Caused by:
[org.apache.camel.RuntimeCamelException -
org.springframework.jms.UncategorizedJmsException: Uncategorized exception
occured during JMS processing; nested exception is javax.jms.JMSException:
User user is not authorized to create: queue://REPLYX]
org.apache.camel.RuntimeCamelException:
org.springframework.jms.UncategorizedJmsException: Uncategorized exception
occured during JMS processing; nested exception is javax.jms.JMSException:
User user is not authorized to create: queue://REPLYX

Maybe you can use this to further investigate?

<broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" id="broker" useJmx="false" persistent="false"
start="true" dataDirectory="target/data">

<destinations>
<queue physicalName="REQUEST" />
<queue physicalName="REPLY" />
<queue physicalName="DEADLETTER" />
</destinations>
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="user" password="password"
groups="users" />
</users>
</simpleAuthenticationPlugin>
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<authorizationEntry queue=">" write="users"
read="users" admin="admins" />
<authorizationEntry topic=">" write="users"
read="users" admin="users" />
</authorizationEntries>
</authorizationMap>
</map>
</authorizationPlugin>
</plugins>
</broker>


2013/4/15 Magnus Palmér <ma...@gmail.com>

> The best way is to create a JUnit test that uses ActiveMQ so it can
> potentially become a part of the source.
> Using ActiveMQ you will need to make sure that you don't dynamically
> create new destinations on the fly.
> http://activemq.apache.org/how-do-i-create-new-destinations.html
>
> I think I would then go for the option of creating the destinations needed
> upon startup.
> http://activemq.apache.org/configure-startup-destinations.html
>
> Maybe someone who is more experienced with the Camel JMS component has
> some other input?
>
>
> 2013/4/15 praveenbillampati <pr...@gmail.com>
>
>> Thanks for the try magnuspalmer. I too tried for junit tests but don't
>> find
>> any.. Let me know if you have any other ideas on the approach.. I can try
>> it
>> out..
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730895.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
>


-- 
Brgds, Magnus Palmér
+46736845680

Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

Posted by Magnus Palmér <ma...@gmail.com>.
The best way is to create a JUnit test that uses ActiveMQ so it can
potentially become a part of the source.
Using ActiveMQ you will need to make sure that you don't dynamically create
new destinations on the fly.
http://activemq.apache.org/how-do-i-create-new-destinations.html

I think I would then go for the option of creating the destinations needed
upon startup.
http://activemq.apache.org/configure-startup-destinations.html

Maybe someone who is more experienced with the Camel JMS component has some
other input?


2013/4/15 praveenbillampati <pr...@gmail.com>

> Thanks for the try magnuspalmer. I too tried for junit tests but don't find
> any.. Let me know if you have any other ideas on the approach.. I can try
> it
> out..
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730895.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

Posted by praveenbillampati <pr...@gmail.com>.
Thanks for the try magnuspalmer. I too tried for junit tests but don't find
any.. Let me know if you have any other ideas on the approach.. I can try it
out..

 



--
View this message in context: http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730895.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

Posted by Magnus Palmér <ma...@gmail.com>.
I am going crazy over this one, spent a couple of hours on it but most
likely it is due to my inexperience with the camel source code.

I thought I had reproduced the problem but now I don't any longer.
Anyway, I don't get the infinity retries with 2.11-SNAPSHOT or 2.10.4 when
there is an error on the replyTo on the message.
(I do get it when there is an invalid replyTo configured on the endpoint
itself. )

The exceptionListener is not passed into the reply when replying.
It is even so that when I have an error on both the route (invalid to
destination), the deadletter handler (trying to send to an WMQ error
queue) succeeds  but due to the error later in the reply the deadletter
message does not get committed to the error queue, think the replyTo gets
attached to the deadletter destination.

Not sure how to proceed as of now, I guess I will have to see if it is the
same using another JMS provider than IBM WebSphere MQ so I can create a
junit test that works without a WMQ installation.
After just briefly scanning the camel-jms source tests I didn't find a test
with an invalid replyTo destination on the message as received by the jms
consumer.


2013/4/13 praveenbillampati <pr...@gmail.com>

> Route is able to listen on the from queue correctly.
>
> I tried keeping exception listener, however it is not listening the
> exception. Below is the configuration.
>
> package com.aaa.bbb.ccc;
> import javax.jms.ExceptionListener;
> import javax.jms.JMSException;
>
> public class JMSExceptionListener implements ExceptionListener {
>     public JMSExceptionListener() {
>         super();
>         System.out.println("started exception listener");
>     }
>
>     @Override
>     public void onException(JMSException ex) {
>         System.out.println("EXCEPTION CAUGHT:::" + ex.getMessage());
>     }
> }
>  <bean id="jmsExceptionListener"
> class="com.aaa.bbb.ccc.JMSExceptionListener" />
>
>  <bean id="jmsDestResolver"
> class="org.springframework.jms.support.destination.JndiDestinationResolver"
> />
>
>  <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate" />
>
>  <bean id="mqConnectionFactory"
> class="org.springframework.jndi.JndiObjectFactoryBean">
>     <property name="jndiTemplate" ref="jndiTemplate" />
>     <property name="jndiName" value="java:comp/env/jms/xyz/xyzQCF" />
>     <property name="resourceRef" value="true" />
>   </bean>
>
>  <bean id="jmsTransactionManager"
> class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="mqConnectionFactory" />
>   </bean>
>
>  <bean id="mqConfig"
> class="org.apache.camel.component.jms.JmsConfiguration">
>     <property name="connectionFactory" ref="mqConnectionFactory" />
>     <property name="transactionManager" ref="jmsTransactionManager" />
>     <property name="transacted" value="true" />
>     <property name="destinationResolver" ref="jmsDestResolver" />
>         <property name="exceptionListener" ref="jmsExceptionListener" />
>   </bean>
>
>  <bean id="mqjms" class="org.apache.camel.component.jms.JmsComponent">
>     <property name="configuration" ref="mqConfig" />
>   </bean>
>
> I could see the initialization of exception listener, but it is not getting
> invoked on the exception.
>
> Is this missing something?
>
> Thanks
> Praveen
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730796.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Brgds, Magnus Palmér

Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

Posted by praveenbillampati <pr...@gmail.com>.
Route is able to listen on the from queue correctly.  

I tried keeping exception listener, however it is not listening the
exception. Below is the configuration.

package com.aaa.bbb.ccc;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;

public class JMSExceptionListener implements ExceptionListener {
    public JMSExceptionListener() {
        super();
        System.out.println("started exception listener");
    }

    @Override
    public void onException(JMSException ex) {
        System.out.println("EXCEPTION CAUGHT:::" + ex.getMessage());
    }
}
 <bean id="jmsExceptionListener"
class="com.aaa.bbb.ccc.JMSExceptionListener" />

 <bean id="jmsDestResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver"
/>

 <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate" />

 <bean id="mqConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName" value="java:comp/env/jms/xyz/xyzQCF" />
    <property name="resourceRef" value="true" />
  </bean>

 <bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
    <property name="connectionFactory" ref="mqConnectionFactory" />
  </bean>
 
 <bean id="mqConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="mqConnectionFactory" />
    <property name="transactionManager" ref="jmsTransactionManager" />
    <property name="transacted" value="true" />
    <property name="destinationResolver" ref="jmsDestResolver" />
	<property name="exceptionListener" ref="jmsExceptionListener" />
  </bean>

 <bean id="mqjms" class="org.apache.camel.component.jms.JmsComponent">
    <property name="configuration" ref="mqConfig" />
  </bean>

I could see the initialization of exception listener, but it is not getting
invoked on the exception.

Is this missing something?

Thanks
Praveen




--
View this message in context: http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730796.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

Posted by Magnus Palmér <ma...@gmail.com>.
The from jms destination is not valid syntax for a WMQ object when looking
at your route configuration but I guess that is not the exact one since the
error log you provided talks about something else.

The problem is that there is a listener setup failure that will cause a
retry every 5 seconds due to
org.springframework.jms.listener.DefaultMessageListenerContainer if I
understand the code correctly (looking in camel-jms 2.11 and spring-.jms
3.1.4

I guess you can do as Claus suggested in the link from your first question
and configure an exceptionListener.

Although I wonder if it would be in place to
let org.apache.camel.component.jms.DefaultJmsMessageListenerContainer
override the handleListenerSetupFailure method from
o.s.j.l.DefaultMessageListenerContainer so that Camels errorhandler can
handle the error instead?

I am not used to work with these low level JMS details so not sure though.


2013/4/12 praveenbillampati <pr...@gmail.com>

> Any ideas..?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730768.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Brgds, Magnus Palmér