Ok, I've given this a whirl for a few days, would appreciate some help. We
have a JMS topic publishing events and I want to connect to it via service
mix. I've been attempting to use the servicemix-jms component.

I've worked through most of the issues but there is one hurdle I can't seem
to get over. The topic requires a username and password when the connection
is created. In code, it looks like this:

/*********** java code
TopicConnectionFactory factory = (TopicConnectionFactory)
ctx.lookup("ConnectionFactory");
Topic eventTopic = (Topic) ctx.lookup(topicName);
System.out.println("Found JMS topic.");

TopicConnection topicConnection = factory.createTopicConnection("xyzUser",
"xyzPass");

TopicSession topicSession = topicConnection.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
TopicSubscriber topicSubscriber = topicSession.createSubscriber(eventTopic);
System.out.println("Connected to topic.");
topicSubscriber.setMessageListener(this);
********** end java code */

Notice the factory.createTopicConnection() method taking the username and
password.

In my xbean.xml configuration for the jms component, I have the following:
(the xyJndiTemplate is a customer class that will not only set JNDI
properties but some system properties required for the JMS connection -
right now, values are hardcoded)
/********** xbean config
<beans xmlns:jms="http://servicemix.apache.org/jms/1.0";
       xmlns:b="http://servicemix.apache.org/samples/vc1";>

<classpath>
        <location>lib/jbossall-client-4.0.2.GA.jar</location>
        <location>lib/xy-common-1.0-SNAPSHOT.jar</location>
</classpath>

<jms:endpoint service="b:MyConsumerService"
              endpoint="jms"
              targetService="b:pipeline"
              targetEndpoint="myConsumer"
              role="consumer" 
              destinationStyle="topic"
             
initialContextFactory="org.jboss.naming.HttpNamingContextFactory"
              jndiProviderURL="http://192.168.5.5:8881/invoker/JNDIFactory";
              jndiDestinationName="topic/MyTopicName"
              jndiConnectionFactoryName="ConnectionFactory"
              defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
              defaultOperation="test:Echo"
              needJavaIdentifiers="false" />                



<bean id="props" autowire="no"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                <property name="location" value="C:\temp\xy_launch.properties"/>
                <property name="systemPropertiesModeName"
value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
        </bean>

   <bean id="xyJndiTemplate" class="com.xy.common.util.JndiTemplate">

                <constructor-arg>
                        <props>
                                <prop
key="java.naming.factory.initial">org.jboss.naming.HttpNamingContextFactory</prop>
                                <prop
key="java.naming.provider.url">http://192.168.5.5:8881/invoker/JNDIFactory</prop>
                                <prop
key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
                        </props>                        
                </constructor-arg>
                <property name="systemProperties">
                        <props>
                                <prop
key="xy.ejb_invoker_servlet_path">http://192.168.5.5:8881/invoker/EJBInvokerServlet</prop>
                                <prop
key="xy.jmx_invoker_servlet_path">http://192.168.5.5:8881/invoker/JMXInvokerServlet</prop>
                                <prop
key="java.security.auth.login.config">C:\temp\jms_test\auth.conf</prop>
                        </props>                        
                </property>
        </bean>
***************** end xbean config ***********/

The problem is that there doesn't seem to be anywhere to specify the
username and password used when the connection is created as there is in
code. So I tried somewhat desperately to use the connection factory from
ActiveMQ and set the connection factory in the jms component to use it
(using the #connectionFactory as the value)

  <bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="tcp://localhost:61616" />
    <property name="userName" value="xyUser" />
    <property name="password" value="xyPass" />
  </bean>
              
But that just seemed give me a local connection out of the pool, which isn't
what I needed. I needed to get a connection from the factory on the other
JMS server.

Anyway, I'm trying to accomplish using the component what we do in the code
example but can't seem to figure it out. I'm pretty sure the issue is the
username and password on the connection because when I deploy the component,
the error message is that "not authorized to subscribe to topic
MyTopicName". All the other connection issues seem to work as I have
resolved them one by one.

Any insight would be greatly appreciated.
-- 
View this message in context: 
http://www.nabble.com/JMS-consumer-issue-tf4957536s12049.html#a14197444
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to