You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by pwanner <pw...@pwanner.com> on 2011/07/12 13:09:33 UTC

Problem with ActiveMQ to Weblogic route

Hi everybody, 

I'm having trouble with a Camel route from ActiveMq to Weblogic. 

The use case is very simple, I have a Tomcat and an ActiveMq instance on the
same server. 
The application in Tomcat is posting in the local ActiveMQ and the Camel
route is forwarding the message to the queue in Weblogic on a different
server. 

Every time a message is posted this exception appears in the log: 

org.springframework.jms.UncategorizedJmsException: Uncategorized exception
occured during JMS processing; nested exception is javax.jms.JMSException:
Could no disambiguate on queue|Topic-name totransform pollymorphic
destination into a ActiveMQ destination: testjmsmodule!ToActiveMq 
at
org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316) 
at
org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168) 
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469) 
at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:170) 
at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:355) 
at
org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:309) 
at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:99) 
... 


Despite the exception the message is delivered is the Weblogic ToActiveMq
queue, but as I need to switch now to a transactional delivery, the message
is will be rollbacked. 

Any idea what this error comes from? 


Below is my camel.xml config (using ActiveMQ 5.5.0, Camel 2.7.0 and Weblogic
9.2): 
  
  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
      <route>
          <from uri="activemq:queue:to.weblogic"/>
          <to uri="weblogic:queue:ToActiveMq"/>
      </route>
  </camelContext>
  
  <bean id="weblogic" class="org.apache.camel.component.jms.JmsComponent">
      <property name="connectionFactory" ref="weblogicConnectionFactory"/>
      <property name="destinationResolver"
ref="weblogicDestinationResolver"/>
  </bean>

  <bean id="weblogicDestinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver">
      <property name="jndiTemplate" ref="remoteJndi" />  
  </bean>

  <bean id="weblogicConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiTemplate" ref="remoteJndi" />
      <property name="jndiName" value="weblogic.jms.ConnectionFactory" />
  </bean>

  <bean id="remoteJndi" class="org.springframework.jndi.JndiTemplate">  
      <property name="environment">  
          <props>  
              <prop
key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>  
              <prop key="java.naming.provider.url">t3://host:7004</prop>
          </props>
      </property>  
   </bean>    

  <bean id="activemqTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
      <property name="connectionFactory" ref="activemqConnectionFactory" />
  </bean>

  <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent" >
      <property name="connectionFactory" ref="activemqConnectionFactory"/>
  </bean>
  
  <bean id="activemqConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
      <property name="brokerURL" value="tcp://localhost:8016" />
  </bean>
 



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-with-ActiveMQ-to-Weblogic-route-tp3661981p3661981.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem with ActiveMQ to Weblogic route

Posted by pwanner <pw...@pwanner.com>.
You can follow the rest of the thread here

http://camel.465427.n5.nabble.com/Problem-with-ActiveMQ-to-Weblogic-route-td4578300.html

--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-with-ActiveMQ-to-Weblogic-route-tp3661981p3667682.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem with ActiveMQ to Weblogic route

Posted by pwanner <pw...@pwanner.com>.
Actualy I found from where the error comes :

The JNDI lookup to Weblogic return a weblogic.jms.common.DestinationImpl
instance that is the Weblogic generic implementation for Queue and Topic.

In the org.apache.activemq.command.ActiveMQDestination class the transform()
method can obtain both a queue name and a topic name and therefore doesn't
know in witch one to cast.

The Weblogic impl has two methods isQueue() and isTopic() for that.

But now I have no idea for any workaround.
Any help would be appreciated...


See the ActiveMQDestination class code below

    public static ActiveMQDestination transform(Destination dest) throws
JMSException {
        if (dest == null) {
            return null;
        }
        if (dest instanceof ActiveMQDestination) {
            return (ActiveMQDestination)dest;
        }
        
        if (dest instanceof Queue && dest instanceof Topic) {
            *String queueName = ((Queue) dest).getQueueName();
            String topicName = ((Topic) dest).getTopicName();* 
           if (queueName != null && topicName == null) {
                return new ActiveMQQueue(queueName);
            } else if (queueName == null && topicName != null) {
                return new ActiveMQTopic(topicName);
            }
            throw new JMSException("Could no disambiguate on
queue|Topic-name totransform pollymorphic destination into a ActiveMQ
destination: " + dest);
        }
        if (dest instanceof TemporaryQueue) {
            return new
ActiveMQTempQueue(((TemporaryQueue)dest).getQueueName());
        }
        if (dest instanceof TemporaryTopic) {
            return new
ActiveMQTempTopic(((TemporaryTopic)dest).getTopicName());
        }
        if (dest instanceof Queue) {
            return new ActiveMQQueue(((Queue)dest).getQueueName());
        }
        if (dest instanceof Topic) {
            return new ActiveMQTopic(((Topic)dest).getTopicName());
        }
        throw new JMSException("Could not transform the destination into a
ActiveMQ destination: " + dest);
    }


--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-with-ActiveMQ-to-Weblogic-route-tp3661981p3664894.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.