I am trying to write a simple JMS client (external) which will lookup the ConnectionFactory and destination using JNDI and send a message to the destination without using any 3rd party or ActiveMq API's. For this I customized loanbroker example by removing all the classes except for JMSClient and LoanBroker.
This is the snippet of my JMSClient Properties props = new Properties(); props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory" ); props.put(Context.PROVIDER_URL, "tcp://localhost:61616/"); jndiContext = new InitialContext(props); connectionFactory = (ConnectionFactory) jndiContext.lookup("ConnectionFactory"); dest = (Destination) jndiContext.lookup("jndiEx.source"); connection = connectionFactory.createConnection(); Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); MessageProducer producer = session.createProducer(dest); producer.send(session.createTextMessage("<message>Hello, world!</message>")); I have configured the same destination name in servicemix.xml file. I successfully built and deployed this SA into Servicemix. When I run, the follow exception is thrown JNDI API lookup failed: javax.naming.NameNotFoundException: jndiEx.source javax.naming.NameNotFoundException: jndiEx.source at org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:215) 1. Please help me out to resolve this issue? 2. Is it possible to use SpringInitialContextFactory and implement the same? 3. If I have to use jndi.properties to configure ConnectionFactory and destination name as per http://activemq.apache.org/jndi-support.html, then where do I need to keep this property file so that it is used only for this example. Thanks in advance Andrea Zoppello-2 wrote: > > Hi, > > You must ensure that all component that your're using will propagate the > correlation id. > Most of the components have support for this, but i think this is not > sure for all. > > We've had the same problem, with spagic development where we use the > correlation ID to > support the concept of Process and Process Instance, and in general when > we've found a component > that don't support correlation ID propagtion we've raised a JIRA and a > patch for this. > > By the way i've not clear your flow, but as i know all component you > need support that feature. > > Andrea > > Abdeslam El Abbassi ha scritto: >> Hi, >> i have to keep a correlation between SU, ie i want to have one id for >> all su of my pattern (flow) >> My flow consist to : >> >> HTTP > JMS > EIP > XSLT > JMS > HTTP >> >> So how to use the correlationID and how to pass it in NMR messages ? >> >> Regards, >> >> Abdeslam El Abbassi >> Thales Services >> >> > > > -- View this message in context: http://www.nabble.com/JNDI-lookup-for-ConnectionFactory-and-destination-failing-tf4797276s12049.html#a13725710 Sent from the ServiceMix - User mailing list archive at Nabble.com.