camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: JMS Component WITHOUT Spring
Date Mon, 19 Jul 2010 18:13:41 GMT

On Mon, Jul 19, 2010 at 8:06 PM, Ron Smith <> wrote:
> Where I work, Spring has been declared "evil" so I am attempting to use
> camel without any of the Spring JARs but I can't find any examples of how to
> setup a JMS component without a Spring dependency. I am using Tibco as the
> JMS provider and it is providing JNDI.

It must be a touch workplace when a general considered standard
framework is considered evil?

The camel-jms component leverages spring-jms for sending and receiving
JMS messages and therefore
you cannot use it without spring-jms.

You can use plain JMS API if you want to avoid Spring and build a JMS consumer.
For examples see the ActiveMQ in Action which shows that. And I am
sure you may find other examples by googling as well.

To send the message to Camel is very easy from Java code. For example
just use the ProducerTemplate API.

> Here is a sample code snippet which shows the JNDI and JMS setup that I need
> for the component:
> final CamelContext context = new DefaultCamelContext();
> final Hashtable env = new Hashtable();
> "com.tibco.tibjms.naming.TibjmsInitialContextFactory");
> env.put(Context.PROVIDER_URL, Constants.TOPIC_PROVIDER_URL));
> final Context jndiContext = new InitialContext(env);
> final TopicConnectionFactory topicConnectionFactory =
> (TopicConnectionFactory)
> jndiContext.lookup(Constants.TOPIC_CONNECTION_FACTORY));
> context.addComponent("tibco",
> JmsComponent.jmsComponentAutoAcknowledge(topicConnectionFactory));
> This compiles without any Spring JARs but, when I run it I get the following
> exception thrown by the last line of code:
> Caused by: java.lang.ClassNotFoundException:
> org.springframework.context.ApplicationContextAware
> NOTE: I am currently looking into the possibility that this is actually an
> issue with the DefaultCamelContext being dependent on Spring rather that it
> being a JMS or component issue. In any case, I would appreciate any advice
> or guidance on this.

Claus Ibsen
Apache Camel Committer

Author of Camel in Action:
Open Source Integration:

View raw message