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.

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();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.tibco.tibjms.naming.TibjmsInitialContextFactory");
env.put(Context.PROVIDER_URL, Constants.TOPIC_PROVIDER_URL));
env.put(Context.SECURITY_PRINCIPAL, Constants.TOPIC_SECURITY_PRINCIPAL));
env.put(Context.SECURITY_CREDENTIALS,
Constants.TOPIC_SECURITY_CREDENTIALS));
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.

Reply via email to