Hi

As told on another thread. camel-jms leverages spring-jms and
therefore you need all the spring jars that spring-jms requires.
The maven pom.xml file will help you.

You need all the *compile* jars, the spec jars is optional (eg the JMS
API, JTA API etc.)
And since this is from JDK 1.5 there are some XML jars you dont need
on Java 1.6 as they are provided out of the box.


[INFO] Building Camel :: JMS
[INFO]    task-segment: [dependency:list]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:list]
[INFO]
[INFO] The following files have been resolved:
[INFO]    aopalliance:aopalliance:jar:1.0:compile
[INFO]    com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile
[INFO]    commons-logging:commons-logging:jar:1.1.1:test
[INFO]    commons-logging:commons-logging-api:jar:1.1:compile
[INFO]    commons-net:commons-net:jar:2.0:test
[INFO]    commons-pool:commons-pool:jar:1.5.4:test
[INFO]    javax.activation:activation:jar:1.1:compile
[INFO]    javax.annotation:jsr250-api:jar:1.0:test
[INFO]    javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO]    javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO]    junit:junit:jar:4.8.1:test
[INFO]    log4j:log4j:jar:1.2.16:test
[INFO]    org.apache.activemq:activeio-core:jar:3.1.2:test
[INFO]    org.apache.activemq:activemq-camel:jar:5.3.2:test
[INFO]    org.apache.activemq:activemq-core:jar:5.3.2:test
[INFO]    org.apache.activemq:activemq-pool:jar:5.3.2:test
[INFO]    org.apache.activemq:kahadb:jar:5.3.2:test
[INFO]    org.apache.activemq.protobuf:activemq-protobuf:jar:1.0:test
[INFO]    org.apache.camel:camel-core:jar:2.5-SNAPSHOT:compile
[INFO]    org.apache.camel:camel-core:test-jar:tests:2.5-SNAPSHOT:test
[INFO]    org.apache.camel:camel-spring:jar:2.5-SNAPSHOT:compile
[INFO]    org.apache.camel:camel-spring:test-jar:tests:2.5-SNAPSHOT:test
[INFO]    org.apache.camel:camel-test:jar:2.5-SNAPSHOT:test
[INFO]    
org.apache.geronimo.specs:geronimo-j2ee-management_1.0_spec:jar:1.1:test
[INFO]    
org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:test
[INFO]    org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile
[INFO]    org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0.1:test
[INFO]    org.apache.xbean:xbean-spring:jar:3.5:test
[INFO]    org.fusesource.commonman:commons-management:jar:1.0:compile
[INFO]    org.jencks:jencks-amqpool:jar:2.2:test
[INFO]    org.osgi:org.osgi.core:jar:4.1.0:test
[INFO]    org.springframework:spring-aop:jar:3.0.3.RELEASE:compile
[INFO]    org.springframework:spring-asm:jar:3.0.3.RELEASE:compile
[INFO]    org.springframework:spring-beans:jar:3.0.3.RELEASE:compile
[INFO]    org.springframework:spring-context:jar:3.0.3.RELEASE:compile
[INFO]    org.springframework:spring-core:jar:3.0.3.RELEASE:compile
[INFO]    org.springframework:spring-expression:jar:3.0.3.RELEASE:compile
[INFO]    org.springframework:spring-jms:jar:3.0.3.RELEASE:compile
[INFO]    org.springframework:spring-test:jar:3.0.3.RELEASE:test
[INFO]    org.springframework:spring-tx:jar:3.0.3.RELEASE:compile
[INFO]    org.springframework.osgi:spring-osgi-core:jar:1.2.0:test
[INFO]    org.springframework.osgi:spring-osgi-io:jar:1.2.0:test
[INFO]
[INFO] ------------------------------------------------------------------------


On Tue, Jul 20, 2010 at 5:44 AM, Ron Smith <ronsmit...@gmail.com> wrote:
> I have just extracted a minimal example which demonstrates the issue:
>
> import org.apache.camel.CamelContext;
> import org.apache.camel.component.jms.JmsComponent;
> import org.apache.camel.impl.DefaultCamelContext;
>
> import javax.jms.TopicConnectionFactory;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import java.util.Hashtable;
>
> public class DemonstrateBug {
>
>    public static void main(String[] args) throws Exception {
>        final CamelContext context = new DefaultCamelContext();
>        final Hashtable<String,String> env = new Hashtable<String,String>();
>        env.put(Context.INITIAL_CONTEXT_FACTORY,
> "com.tibco.tibjms.naming.TibjmsInitialContextFactory");
>        env.put(Context.PROVIDER_URL, "tcp://myjmsserver:65000");
>        env.put(Context.SECURITY_PRINCIPAL, "myprincipal");
>        env.put(Context.SECURITY_CREDENTIALS, "mycredentials");
>        final Context jndiContext = new InitialContext(env);
>        final TopicConnectionFactory topicConnectionFactory =
>                (TopicConnectionFactory)
> jndiContext.lookup("mytopicfactory");
>
>        context.addComponent("tibco",
>
>  JmsComponent.jmsComponentAutoAcknowledge(topicConnectionFactory));
>    }
> }
>
>
> Compile this class with everything from the camel 2.4.0 lib directory
> (including the optional stuff) plus tibjms.jar, ojdbc14.jar and
> junit-4.4.jar (these are the same versions of the same jars I am using with
> 2.3.0 which don't contain any reference to Spring classes or jars).  The
> last line of code throws:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
>        org/springframework/transaction/PlatformTransactionManager
> at DemonstrateBug.main(DemonstrateBug.java:22)
>
>
>
>
> On Mon, Jul 19, 2010 at 10:20 PM, Ron Smith <ronsmit...@gmail.com> wrote:
>
>> I just double checked my classpath and rebuilt everything from scratch.
>> Definitely nothing from Spring 2.x included.
>>
>>
>> On Mon, Jul 19, 2010 at 8:52 PM, Willem Jiang <willem.ji...@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> Camel 2.4.0 uses Spring 3.0.3 by default, please make sure your class path
>>> doesn't have any Spring 2.x jars.
>>>
>>>
>>> Willem
>>> ----------------------------------
>>>  Apache Camel, Apache CXF committer
>>>  Open Source Integration http://www.fusesource.com
>>>  Blog http://willemjiang.blogspot.com
>>>  Tiwtter http://twitter.com/willemjiang
>>>
>>> Ron Smith wrote:
>>>
>>>> After moving from camel 2.3.0 to 2.4.0 I am getting the error:
>>>>
>>>> java.lang.ClassNotFoundException:
>>>> org.springframework.transaction.PlatformTransactionManager
>>>>
>>>> when I execute:
>>>>
>>>> context.addComponent("myjms",
>>>> JmsComponent.jmsComponentAutoAcknowledge(topicConnectionFactory));
>>>>
>>>> I am including every JAR in the lib directory including the optional
>>>> ones.
>>>> This is code that was working in 2.3.0.
>>>>
>>>>
>>>
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to