Re: java.lang.NoClassDefFoundError when running CamelJmsToFileExample

2009-03-05 Thread m.s.

I've downloaded the windows binaries for camel 1.6 and tried do run the
example in the NetBeans IDE. I added the required jars to the libraries.

I also tried to run the example with maven, but just got another error:

[INFO]

[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: An exception occured
while executing the Java class.
org.apache.camel.example.jmstofile.CamelJmsToFileExample
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:701)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:551)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:521)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:369)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:330)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:302)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception
occured while executing the Java class.
org.apache.camel.example.jmstofile.CamelJmsToFileExample
at
org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:338)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:458)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:676)
... 16 more
Caused by: java.lang.ClassNotFoundException:
org.apache.camel.example.jmstofile.CamelJmsToFileExample
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:276)
at java.lang.Thread.run(Thread.java:619)
[INFO]

-- 
View this message in context: 
http://www.nabble.com/java.lang.NoClassDefFoundError-when-running-CamelJmsToFileExample-tp22341345p22347426.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



Re: Is it possible to overload a bean method?

2009-03-05 Thread Claus Ibsen
On Thu, Mar 5, 2009 at 9:40 AM, ee7arh andrew.hu...@2e-systems.com wrote:

 Thanks for the feedback,

 It looks like we are talking about the same use case. In my example, all my
 methods had the same name, but each method had a different parameter
 (Object1, 2 and 3). Each of these parameter types inheritted from Objectn.
 So each method did have a different concrete sub-type although all are
 instances of Objectn. In your example, your 3rd method has a different
 name... was that a typo?
Yeah probably.

 I could certainly use different method names, it would just mean I have to
 have some more logic in my RouteBuilder. At the moment, I just send objects
 off the queue to the same bean method and ask it to take care of selecting
 the correct one by overloading.
You can send it to an indirect method that will check the type and
invoke the correct method of the 3.
Then you route can stay simple.




 Thanks and Regards
 Andrew


 ee7arh wrote:

 Hi,

 I have a bean defined which has 3 methods all with same name but with
 different arguements. I would like to route messages from a queue to this
 bean and depending on the object type I was hoping that the correct method
 would get called by overloading.

 Instead i get the error:

 org.apache.camel.NoTypeConversionAvailableException: No type converter
 available to convert from type:.

 I noticed that the first method defined in my bean caused this error so it
 looks like Camel takes the 1st method and tries (and fails) to convert the
 message.

 here is my bean definition:

 @Service(value = serviceEventGenerator)
 public class ServiceEventGenerator {

     public ArrayListServiceEvent generateServiceEvents(Object1 event) {}

     public ArrayListServiceEvent generateServiceEvents(Object2 event) {}

     public ArrayListServiceEvent generateServiceEvents(Object3 event) {}

 }

 (Incidentally in my example, Object 1,2 and 3 all extend from a parent
 class Objectn.)

 And my route:

 from(jms:queue:unmarshalledEventsQueue)
             .to(log:unmarshalledEventLogger?level=INFO)

 .to(bean:serviceEventGenerator?methodName=generateServiceEvents)

 Thanks in advance for any help

 Andrew


 --
 View this message in context: 
 http://www.nabble.com/Is-it-possible-to-overload-a-bean-method--tp22338316p22347357.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Re: Is it possible to overload a bean method?

2009-03-05 Thread Claus Ibsen
BTW

I created a ticket for it
https://issues.apache.org/activemq/browse/CAMEL-1424


On Thu, Mar 5, 2009 at 9:49 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 On Thu, Mar 5, 2009 at 9:40 AM, ee7arh andrew.hu...@2e-systems.com wrote:

 Thanks for the feedback,

 It looks like we are talking about the same use case. In my example, all my
 methods had the same name, but each method had a different parameter
 (Object1, 2 and 3). Each of these parameter types inheritted from Objectn.
 So each method did have a different concrete sub-type although all are
 instances of Objectn. In your example, your 3rd method has a different
 name... was that a typo?
 Yeah probably.

 I could certainly use different method names, it would just mean I have to
 have some more logic in my RouteBuilder. At the moment, I just send objects
 off the queue to the same bean method and ask it to take care of selecting
 the correct one by overloading.
 You can send it to an indirect method that will check the type and
 invoke the correct method of the 3.
 Then you route can stay simple.




 Thanks and Regards
 Andrew


 ee7arh wrote:

 Hi,

 I have a bean defined which has 3 methods all with same name but with
 different arguements. I would like to route messages from a queue to this
 bean and depending on the object type I was hoping that the correct method
 would get called by overloading.

 Instead i get the error:

 org.apache.camel.NoTypeConversionAvailableException: No type converter
 available to convert from type:.

 I noticed that the first method defined in my bean caused this error so it
 looks like Camel takes the 1st method and tries (and fails) to convert the
 message.

 here is my bean definition:

 @Service(value = serviceEventGenerator)
 public class ServiceEventGenerator {

     public ArrayListServiceEvent generateServiceEvents(Object1 event) {}

     public ArrayListServiceEvent generateServiceEvents(Object2 event) {}

     public ArrayListServiceEvent generateServiceEvents(Object3 event) {}

 }

 (Incidentally in my example, Object 1,2 and 3 all extend from a parent
 class Objectn.)

 And my route:

 from(jms:queue:unmarshalledEventsQueue)
             .to(log:unmarshalledEventLogger?level=INFO)

 .to(bean:serviceEventGenerator?methodName=generateServiceEvents)

 Thanks in advance for any help

 Andrew


 --
 View this message in context: 
 http://www.nabble.com/Is-it-possible-to-overload-a-bean-method--tp22338316p22347357.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/




-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Re: Error: This SpringBuilder is not being used with a SpringCamelContext and there is no applicationContext property configured

2009-03-05 Thread willem.jiang

Hi , 

You can use 
SpringCamelContext.springCamelContext(applicationContext);
to create a SpringCamelContext from an applicationContext.

Willem



ee7arh wrote:
 
 Too add a bit more information
 
 I found the code which throws this error in the camel source base:
 
 public ApplicationContext getApplicationContext() {
 +if (applicationContext == null) {
 +CamelContext camelContext = getContext();
 +if (camelContext instanceof SpringCamelContext) {
 +SpringCamelContext springCamelContext =
 (SpringCamelContext) camelContext;
 +return springCamelContext.getApplicationContext();
 +}
 +else {
 +throw new IllegalArgumentException(This SpringBuilder is
 not being used
 with a SpringCamelContext and there is no applicationContext property
 configured);
 +}
 +}
 
 
 So the problem seems to be that I have an instance of CamelContext instead
 of SpringCamelContext. SpringcamelContext extends camelcontext incidently.
 
 the questions is - how can I create an instance of SpringCamelContext from
 within my Spring xml?
 
 To refer back to my original post, I have this piece of XML to create, I
 guess, a normal camelContext:
 
 camel:camelContext id=camel2
 xmlns=http://activemq.apache.org/camel/schema/spring;
 camel:packagecom.mycompany.mypackage/camel:package
 /camel:camelContext 
 
 I was hoping it would be as simply as changing camelContext to
 SpringCamelContext but sadly not ;)
 
 Can anyone indicate if this is something perhaps currently not supported,
 or hopefully offer a solution? maybe I can't use spring xml for this?
 
 I am using the SpringRouteBuilder because I want to be able to ensure that
 messages are persisted from 1 queue to another (i.e. if somebody pulls out
 the plug during processing within a bean, my message will still exist on
 the from queue and not be lost). So if Camel supports transactions
 another way, would gladly use that instead.
 
 Thanks for any feedback
 
 andrew
 

-- 
View this message in context: 
http://www.nabble.com/Error%3A-This-SpringBuilder-is-not-being-used-with-a-SpringCamelContext-and-there-is-no-applicationContext-property-configured-tp22326547p22347500.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



MinaConfiguration codec property

2009-03-05 Thread Nicolas Bouillon
Hi,

i've got an error when trying to create my mina endpoint with spring dsl :

bean id=myCodec class=com.example.MyProtocolCodecFactory
/bean

bean id=myMinaFactory
class=org.apache.camel.component.mina.MinaComponent/

bean id=myMinaEndpoint
  factory-bean=myMinaFactory
  factory-method=createEndpoint
constructor-arg index=0 ref=myMinaConfig/
/bean

bean id=myMinaConfig
class=org.apache.camel.component.mina.MinaConfiguration
property name=protocol value=tcp /
property name=host value=localhost /
property name=port value= /
property name=sync value=true /
property name=codec value=myCodec /
/bean

I got the following error :
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'myMinaEndpoint' defined in class path
resource [spring.xml]: Instantiation of bean failed; nested exception
is org.springframework.beans.factory.BeanDefinitionStoreException:
Factory method [public org.apache.camel.Endpoint
org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
throws java.lang.Exception] threw exception; nested exception is
java.lang.NullPointerException
at 
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at 
org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:139)
at 
org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:83)
at com.example.main(App.java:15)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
Factory method [public org.apache.camel.Endpoint
org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
throws java.lang.Exception] threw exception; nested exception is
java.lang.NullPointerException
at 
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127)
at 
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:435)
... 17 more
Caused by: java.lang.NullPointerException
at 
org.apache.camel.util.CamelContextHelper.lookup(CamelContextHelper.java:152)
at 
org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:170)
at 
org.apache.camel.impl.DefaultComponent.mandatoryLookup(DefaultComponent.java:315)
at 
org.apache.camel.component.mina.MinaComponent.getCodecFactory(MinaComponent.java:360)
at 
org.apache.camel.component.mina.MinaComponent.configureCodecFactory(MinaComponent.java:213)
at 
org.apache.camel.component.mina.MinaComponent.createSocketEndpoint(MinaComponent.java:175)
at 
org.apache.camel.component.mina.MinaComponent.createEndpoint(MinaComponent.java:109)
at 

Re: java.lang.NoClassDefFoundError when running CamelJmsToFileExample

2009-03-05 Thread Claus Ibsen
This is the dependecy reported by maven

[INFO] [dependency:list]
[INFO]
[INFO] The following files have been resolved:
[INFO]aopalliance:aopalliance:jar:1.0:compile
[INFO]backport-util-concurrent:backport-util-concurrent:jar:2.1:compile
[INFO]com.sun.xml.bind:jaxb-impl:jar:2.1.6:compile
[INFO]commons-logging:commons-logging:jar:1.1.1:compile
[INFO]commons-logging:commons-logging-api:jar:1.1:compile
[INFO]commons-pool:commons-pool:jar:1.4:compile
[INFO]javax.activation:activation:jar:1.1:compile
[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:3.8.2:test
[INFO]org.apache.activemq:activeio-core:jar:3.1.0:compile
[INFO]org.apache.activemq:activemq-core:jar:5.2.0:compile
[INFO]org.apache.camel:camel-core:jar:1.6.1-SNAPSHOT:compile
[INFO]org.apache.camel:camel-jms:jar:1.6.1-SNAPSHOT:compile
[INFO]org.apache.camel:camel-spring:jar:1.6.1-SNAPSHOT:compile
[INFO]
org.apache.geronimo.specs:geronimo-j2ee-management_1.0_spec:jar:1.1:compile
[INFO]org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile
[INFO]org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO]org.springframework:spring-aop:jar:2.5.6:compile
[INFO]org.springframework:spring-beans:jar:2.5.6:compile
[INFO]org.springframework:spring-context:jar:2.5.6:compile
[INFO]org.springframework:spring-context-support:jar:2.5.6:compile
[INFO]org.springframework:spring-core:jar:2.5.6:compile
[INFO]org.springframework:spring-jms:jar:2.5.6:compile
[INFO]org.springframework:spring-tx:jar:2.5.6:compile

On Thu, Mar 5, 2009 at 9:53 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 Ah line 50 is the JMS component.

 You need the camel-jms on the classpath.
 And you also need activemq .jars as well.

 On Wed, Mar 4, 2009 at 11:48 PM, m.s. mathis.schwuc...@web.de wrote:

 When I try to run the CamelJmsToFileExample, I get the exception below. Can
 anyone help to figure out what went wrong?

 Cheers,
 M.S:

 04.03.2009 16:40:02 org.apache.camel.impl.DefaultCamelContext init
 INFO: JMX enabled. Using InstrumentationLifecycleStrategy.
 Exception in thread main java.lang.NoClassDefFoundError:
 org/springframework/transaction/PlatformTransactionManager
        at
 cameltest.CamelJmsToFileExample.main(CamelJmsToFileExample.java:50)
 Caused by: java.lang.ClassNotFoundException:
 org.springframework.transaction.PlatformTransactionManager
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 1 more

 --
 View this message in context: 
 http://www.nabble.com/java.lang.NoClassDefFoundError-when-running-CamelJmsToFileExample-tp22341345p22341345.html
 Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/




-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Re: MinaConfiguration codec property

2009-03-05 Thread Claus Ibsen
Hi

You should use ref to refer to another spring bean
 property name=codec ref=myCodec /

value is for string litterals, numbers and such.


On Thu, Mar 5, 2009 at 9:55 AM, Nicolas Bouillon nico...@bouil.org wrote:
 Hi,

 i've got an error when trying to create my mina endpoint with spring dsl :

        bean id=myCodec class=com.example.MyProtocolCodecFactory
        /bean

        bean id=myMinaFactory
 class=org.apache.camel.component.mina.MinaComponent/

        bean id=myMinaEndpoint
              factory-bean=myMinaFactory
              factory-method=createEndpoint
            constructor-arg index=0 ref=myMinaConfig/
        /bean

        bean id=myMinaConfig
 class=org.apache.camel.component.mina.MinaConfiguration
                property name=protocol value=tcp /
                property name=host value=localhost /
                property name=port value= /
                property name=sync value=true /
                property name=codec value=myCodec /
        /bean

 I got the following error :
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'myMinaEndpoint' defined in class path
 resource [spring.xml]: Instantiation of bean failed; nested exception
 is org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory method [public org.apache.camel.Endpoint
 org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
 throws java.lang.Exception] threw exception; nested exception is
 java.lang.NullPointerException
        at 
 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at 
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at 
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        at 
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
        at 
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
        at 
 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:139)
        at 
 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:83)
        at com.example.main(App.java:15)
 Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory method [public org.apache.camel.Endpoint
 org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
 throws java.lang.Exception] threw exception; nested exception is
 java.lang.NullPointerException
        at 
 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127)
        at 
 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:435)
        ... 17 more
 Caused by: java.lang.NullPointerException
        at 
 org.apache.camel.util.CamelContextHelper.lookup(CamelContextHelper.java:152)
        at 
 org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:170)
        at 
 org.apache.camel.impl.DefaultComponent.mandatoryLookup(DefaultComponent.java:315)
        at 
 org.apache.camel.component.mina.MinaComponent.getCodecFactory(MinaComponent.java:360)
        at 
 org.apache.camel.component.mina.MinaComponent.configureCodecFactory(MinaComponent.java:213)
        at 
 

Re: MinaConfiguration codec property

2009-03-05 Thread Nicolas Bouillon
I've already tried that. But the codec property IS a string property,
and then i got the following error :

Caused by: org.springframework.beans.TypeMismatchException: Failed to
convert property value of type [com.example.MyProtocolCodecFactory] to
required type [java.lang.String] for property 'codec'; nested
exception is java.lang.IllegalArgumentException: Cannot convert value
of type [com.example.MyProtocolCodecFactory] to required type
[java.lang.String] for property 'codec': no matching editors or
conversion strategy found
at 
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
... 29 more


On Thu, Mar 5, 2009 at 10:04, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 You should use ref to refer to another spring bean
  property name=codec ref=myCodec /

 value is for string litterals, numbers and such.


 On Thu, Mar 5, 2009 at 9:55 AM, Nicolas Bouillon nico...@bouil.org wrote:
 Hi,

 i've got an error when trying to create my mina endpoint with spring dsl :

        bean id=myCodec class=com.example.MyProtocolCodecFactory
        /bean

        bean id=myMinaFactory
 class=org.apache.camel.component.mina.MinaComponent/

        bean id=myMinaEndpoint
              factory-bean=myMinaFactory
              factory-method=createEndpoint
            constructor-arg index=0 ref=myMinaConfig/
        /bean

        bean id=myMinaConfig
 class=org.apache.camel.component.mina.MinaConfiguration
                property name=protocol value=tcp /
                property name=host value=localhost /
                property name=port value= /
                property name=sync value=true /
                property name=codec value=myCodec /
        /bean

 I got the following error :
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'myMinaEndpoint' defined in class path
 resource [spring.xml]: Instantiation of bean failed; nested exception
 is org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory method [public org.apache.camel.Endpoint
 org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
 throws java.lang.Exception] threw exception; nested exception is
 java.lang.NullPointerException
        at 
 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at 
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at 
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        at 
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
        at 
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
        at 
 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:139)
        at 
 

Re: Error: This SpringBuilder is not being used with a SpringCamelContext and there is no applicationContext property configured

2009-03-05 Thread Willem Jiang
Why don't you use the RouterBuilder if you are using the Spring
configuration file to scan the builders?

Willem
andrew.hu...@2e-systems.com wrote:
 Thanks,
 
 Any idea if this would be possible to do via XML? The problem occurs when 
 Spring scans my packages during startup and finds a SpringRouteBuilder in 
 there. So if I can't do this from XML it would mean that I have to put my 
 SpringRouteBuilder in a package where Sprng can't scan it, then set it up 
 myself somehow A bit unsure of how I would go about that.
 
 Regards
 Andrew
 
 willem.jiang wrote:
 Hi , 

 You can use 
 SpringCamelContext.springCamelContext(applicationContext);
 to create a SpringCamelContext from an applicationContext.

 Willem



 Too add a bit more information

 I found the code which throws this error in the camel source base:

 public ApplicationContext getApplicationContext() {
 +if (applicationContext == null) {
 +CamelContext camelContext = getContext();
 +if (camelContext instanceof SpringCamelContext) {
 +SpringCamelContext springCamelContext =
 (SpringCamelContext) camelContext;
 +return springCamelContext.getApplicationContext();
 +}
 +else {
 +throw new IllegalArgumentException(This SpringBuilder is
 not being used
 with a SpringCamelContext and there is no applicationContext property
 configured);
 +}
 +}


 So the problem seems to be that I have an instance of CamelContext instead
 of SpringCamelContext. SpringcamelContext extends camelcontext incidently.

 the questions is - how can I create an instance of SpringCamelContext from
 within my Spring xml?

 To refer back to my original post, I have this piece of XML to create, I
 guess, a normal camelContext:

 camel:camelContext id=camel2
 xmlns=http://activemq.apache.org/camel/schema/spring;
 camel:packagecom.mycompany.mypackage/camel:package
 /camel:camelContext 

 I was hoping it would be as simply as changing camelContext to
 SpringCamelContext but sadly not ;)

 Can anyone indicate if this is something perhaps currently not supported,
 or hopefully offer a solution? maybe I can't use spring xml for this?

 I am using the SpringRouteBuilder because I want to be able to ensure that
 messages are persisted from 1 queue to another (i.e. if somebody pulls out
 the plug during processing within a bean, my message will still exist on
 the from queue and not be lost). So if Camel supports transactions
 another way, would gladly use that instead.

 Thanks for any feedback

 andrew



 Quoted from: 
 http://www.nabble.com/Error%3A-This-SpringBuilder-is-not-being-used-with-a-SpringCamelContext-and-there-is-no-applicationContext-property-configured-tp22326547p22347500.html
 
 



Re: MinaConfiguration codec property

2009-03-05 Thread Nicolas Bouillon
Should I create my Endpoints such they are attached to my CamelContext ?

On Thu, Mar 5, 2009 at 10:21, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 Sorry yeah its a string as this was how its done in Camel 1.x

 We could change it to a real ProtocolCodecFactory object instead of
 String and then it should work

 For uri you should use the # notation to lookup the codec.

 Btw the NPE you get is because you create it like that using Spring
 style and the endpoint does not have the CamelContext associated.
 And thus it can not got hold of the registry to lookup the codec.

 I will fix it.



 On Thu, Mar 5, 2009 at 10:11 AM, Nicolas Bouillon nico...@bouil.org wrote:
 I've already tried that. But the codec property IS a string property,
 and then i got the following error :

 Caused by: org.springframework.beans.TypeMismatchException: Failed to
 convert property value of type [com.example.MyProtocolCodecFactory] to
 required type [java.lang.String] for property 'codec'; nested
 exception is java.lang.IllegalArgumentException: Cannot convert value
 of type [com.example.MyProtocolCodecFactory] to required type
 [java.lang.String] for property 'codec': no matching editors or
 conversion strategy found
        at 
 org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
        ... 29 more


 On Thu, Mar 5, 2009 at 10:04, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 You should use ref to refer to another spring bean
  property name=codec ref=myCodec /

 value is for string litterals, numbers and such.


 On Thu, Mar 5, 2009 at 9:55 AM, Nicolas Bouillon nico...@bouil.org wrote:
 Hi,

 i've got an error when trying to create my mina endpoint with spring dsl :

        bean id=myCodec class=com.example.MyProtocolCodecFactory
        /bean

        bean id=myMinaFactory
 class=org.apache.camel.component.mina.MinaComponent/

        bean id=myMinaEndpoint
              factory-bean=myMinaFactory
              factory-method=createEndpoint
            constructor-arg index=0 ref=myMinaConfig/
        /bean

        bean id=myMinaConfig
 class=org.apache.camel.component.mina.MinaConfiguration
                property name=protocol value=tcp /
                property name=host value=localhost /
                property name=port value= /
                property name=sync value=true /
                property name=codec value=myCodec /
        /bean

 I got the following error :
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'myMinaEndpoint' defined in class path
 resource [spring.xml]: Instantiation of bean failed; nested exception
 is org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory method [public org.apache.camel.Endpoint
 org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
 throws java.lang.Exception] threw exception; nested exception is
 java.lang.NullPointerException
        at 
 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at 
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at 
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at 
 

DSL Content Router interrupted with splitter() or multicast()

2009-03-05 Thread ee7arh

Hi,

When I tryto use the functions splitter() or multicast() in my DSL
within a choice() block, I am not able to have another when() or even an
otherwise()

Predicate isInvitation
= PredicateBuilder.regex(header(event_type), invitation);

Predicate isReply
= PredicateBuilder.regex(header(event_type), reply);

from(jms:queue:myQueue)
.choice()
.when(isInvitation)
.to(bean:eventMarshaller?methodName=unmarshallTriggerInvites)
.splitter(body()) // This line causes a compilcation problem on the
next when() or otherwise()
.to(jms:queue:unmarshalledEventsQueue))
.when(isFlightUpdate)

If I take out the splitter() line above, all works fine and I can have as
many when() statements as I like. Is there a reason why this doesn't work?

Thanks
Andrew


-- 
View this message in context: 
http://www.nabble.com/DSL-Content-Router-interrupted-with-splitter%28%29-or-multicast%28%29-tp22347983p22347983.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Error: This SpringBuilder is not being used with a SpringCamelContext and there is no applicationContext property configured

2009-03-05 Thread ee7arh

The reason is that I want to use Transactions and as far as I know, only
Spring supports this with PROPOGATION_REQUIRED.

Following line does not compile in standard RouteBulder:

Policy required
= new SpringTransactionPolicy(bean(TransactionTemplate.class,
PROPAGATION_REQUIRED)); 

If there is a way to do transactions in basic RouteBuilder I'm all for it ;)

Thanks
Andrew




willem.jiang wrote:
 
 Why don't you use the RouterBuilder if you are using the Spring
 configuration file to scan the builders?
 
 Willem
 andrew.hu...@2e-systems.com wrote:
 Thanks,
 
 Any idea if this would be possible to do via XML? The problem occurs when
 Spring scans my packages during startup and finds a SpringRouteBuilder in
 there. So if I can't do this from XML it would mean that I have to put my
 SpringRouteBuilder in a package where Sprng can't scan it, then set it up
 myself somehow A bit unsure of how I would go about that.
 
 Regards
 Andrew
 
 willem.jiang wrote:
 Hi , 

 You can use 
 SpringCamelContext.springCamelContext(applicationContext);
 to create a SpringCamelContext from an applicationContext.

 Willem



 Too add a bit more information

 I found the code which throws this error in the camel source base:

 public ApplicationContext getApplicationContext() {
 +if (applicationContext == null) {
 +CamelContext camelContext = getContext();
 +if (camelContext instanceof SpringCamelContext) {
 +SpringCamelContext springCamelContext =
 (SpringCamelContext) camelContext;
 +return springCamelContext.getApplicationContext();
 +}
 +else {
 +throw new IllegalArgumentException(This SpringBuilder
 is
 not being used
 with a SpringCamelContext and there is no applicationContext property
 configured);
 +}
 +}


 So the problem seems to be that I have an instance of CamelContext
 instead
 of SpringCamelContext. SpringcamelContext extends camelcontext
 incidently.

 the questions is - how can I create an instance of SpringCamelContext
 from
 within my Spring xml?

 To refer back to my original post, I have this piece of XML to create, I
 guess, a normal camelContext:

 camel:camelContext id=camel2
 xmlns=http://activemq.apache.org/camel/schema/spring;
 camel:packagecom.mycompany.mypackage/camel:package
 /camel:camelContext 

 I was hoping it would be as simply as changing camelContext to
 SpringCamelContext but sadly not ;)

 Can anyone indicate if this is something perhaps currently not
 supported,
 or hopefully offer a solution? maybe I can't use spring xml for this?

 I am using the SpringRouteBuilder because I want to be able to ensure
 that
 messages are persisted from 1 queue to another (i.e. if somebody pulls
 out
 the plug during processing within a bean, my message will still exist on
 the from queue and not be lost). So if Camel supports transactions
 another way, would gladly use that instead.

 Thanks for any feedback

 andrew



 Quoted from: 
 http://www.nabble.com/Error%3A-This-SpringBuilder-is-not-being-used-with-a-SpringCamelContext-and-there-is-no-applicationContext-property-configured-tp22326547p22347500.html
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Error%3A-This-SpringBuilder-is-not-being-used-with-a-SpringCamelContext-and-there-is-no-applicationContext-property-configured-tp22326547p22347997.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



Re: MinaConfiguration codec property

2009-03-05 Thread Willem Jiang
Hi

Since the myMinaEndpoint is created by the myMinaFactory which has not
the reference from the application context which can be referred by the
camelContext .
So the myMinaEndpoint can't get find the instance of myCodec.

My suggestion is adding a constructor-arg of the camel context under the
bean id=myMinaFactory ...
to let the myMinaFactory hold the reference of camelContext.

Willem


Nicolas Bouillon wrote:
 Hi,
 
 i've got an error when trying to create my mina endpoint with spring dsl :
 
   bean id=myCodec class=com.example.MyProtocolCodecFactory
   /bean
 
   bean id=myMinaFactory
 class=org.apache.camel.component.mina.MinaComponent/
   
   bean id=myMinaEndpoint
 factory-bean=myMinaFactory
 factory-method=createEndpoint
   constructor-arg index=0 ref=myMinaConfig/
   /bean
   
   bean id=myMinaConfig
 class=org.apache.camel.component.mina.MinaConfiguration
   property name=protocol value=tcp /
   property name=host value=localhost /
   property name=port value= /
   property name=sync value=true /
   property name=codec value=myCodec /
   /bean
   
 I got the following error :
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'myMinaEndpoint' defined in class path
 resource [spring.xml]: Instantiation of bean failed; nested exception
 is org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory method [public org.apache.camel.Endpoint
 org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
 throws java.lang.Exception] threw exception; nested exception is
 java.lang.NullPointerException
   at 
 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
   at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
   at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
   at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
   at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
   at java.security.AccessController.doPrivileged(Native Method)
   at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
   at 
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
   at 
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   at 
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
   at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
   at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
   at 
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
   at 
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
   at 
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
   at 
 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:139)
   at 
 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:83)
   at com.example.main(App.java:15)
 Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory method [public org.apache.camel.Endpoint
 org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
 throws java.lang.Exception] threw exception; nested exception is
 java.lang.NullPointerException
   at 
 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127)
   at 
 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:435)
   ... 17 more
 Caused by: java.lang.NullPointerException
   at 
 org.apache.camel.util.CamelContextHelper.lookup(CamelContextHelper.java:152)
   at 
 org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:170)
   at 
 org.apache.camel.impl.DefaultComponent.mandatoryLookup(DefaultComponent.java:315)
   at 
 

Re: MinaConfiguration codec property

2009-03-05 Thread Claus Ibsen
On Thu, Mar 5, 2009 at 10:31 AM, Willem Jiang willem.ji...@gmail.com wrote:
 Hi

 Since the myMinaEndpoint is created by the myMinaFactory which has not
 the reference from the application context which can be referred by the
 camelContext .
 So the myMinaEndpoint can't get find the instance of myCodec.

 My suggestion is adding a constructor-arg of the camel context under the
 bean id=myMinaFactory ...
 to let the myMinaFactory hold the reference of camelContext.
Yes I am adding it right now

bean id=myMinaEndpoint
  factory-bean=myMinaFactory
  factory-method=createEndpoint
constructor-arg index=0 ref=myCamel/
constructor-arg index=1 ref=myMinaConfig/
/bean



 Willem


 Nicolas Bouillon wrote:
 Hi,

 i've got an error when trying to create my mina endpoint with spring dsl :

       bean id=myCodec class=com.example.MyProtocolCodecFactory
       /bean

       bean id=myMinaFactory
 class=org.apache.camel.component.mina.MinaComponent/

       bean id=myMinaEndpoint
             factory-bean=myMinaFactory
             factory-method=createEndpoint
           constructor-arg index=0 ref=myMinaConfig/
       /bean

       bean id=myMinaConfig
 class=org.apache.camel.component.mina.MinaConfiguration
               property name=protocol value=tcp /
               property name=host value=localhost /
               property name=port value= /
               property name=sync value=true /
               property name=codec value=myCodec /
       /bean

 I got the following error :
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'myMinaEndpoint' defined in class path
 resource [spring.xml]: Instantiation of bean failed; nested exception
 is org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory method [public org.apache.camel.Endpoint
 org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
 throws java.lang.Exception] threw exception; nested exception is
 java.lang.NullPointerException
       at 
 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
       at java.security.AccessController.doPrivileged(Native Method)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
       at 
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
       at 
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
       at 
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
       at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
       at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
       at 
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
       at 
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
       at 
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
       at 
 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:139)
       at 
 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:83)
       at com.example.main(App.java:15)
 Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory method [public org.apache.camel.Endpoint
 org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
 throws java.lang.Exception] threw exception; nested exception is
 java.lang.NullPointerException
       at 
 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127)
       at 
 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:435)
       ... 17 more
 Caused by: java.lang.NullPointerException
       at 
 

Re: camel-cxf AXIS2 on SMX4

2009-03-05 Thread Guillaume Nodet
If you create your bundle using maven and the maven bundle plugin, add the
following to the plugin configuraiton:

plugin
groupIdorg.apache.felix/groupId
artifactIdmaven-bundle-plugin/artifactId
configuration
instructions
...

Require-Bundleorg.apache.cxf.cxf-bundle/Require-Bundle
   /instructions

It will ensure that your bundle is not started before the cxf one is
installed.
Hopefully it will solve the problem.

On Thu, Mar 5, 2009 at 10:30, cmoulliard cmoulli...@gmail.com wrote:


 Guillaume,

 Can you explain please what you propose that I do ?

 Could you try adding a Require-Bundle to the cxf
 bundle on your own bundle that fail ? 


 gnodet wrote:
 
  Got an idea.  It may happen that your bundle has been started before the
  CXF
  bundle was started.   Could you try adding a Require-Bundle to the cxf
  bundle on your own bundle that fail ?
 
  On Wed, Mar 4, 2009 at 18:00, Guillaume Nodet gno...@gmail.com wrote:
 
  The JAX-WS spec should have picked up the CXF bundle as a provider.
  Could you rerun your example after setting the following system property
  (in etc/system.properties for example)
 org.apache.servicemix.specs.debug=true
  This should give infos about the specs.  Can you paste those log
  statements
  please ?
 
 
  On Wed, Mar 4, 2009 at 17:40, cmoulliard cmoulli...@gmail.com wrote:
 
 
  Here is the list guillaume
 
  START LEVEL 100
ID   State Spring Level  Name
  [   0] [Active ] [   ] [0] System Bundle (1.5.0.SNAPSHOT)
  [   1] [Active ] [   ] [   10] Apache Felix Prefrences Service
  (1.0.2)
  [   2] [Active ] [   ] [   10] geronimo-annotation_1.0_spec
  (1.1.1)
  [   3] [Active ] [   ] [   10] OSGi R4 Compendium Bundle
 (4.1.0)
  [   4] [Active ] [   ] [   10] Apache ServiceMix Bundles:
  jaxp-ri-1.4.2 (1.4.2.1)
  [   5] [Active ] [   ] [   10] Apache Felix Configuration Admin
  Service (1.0.4)
  [   6] [Active ] [   ] [   10] geronimo-servlet_2.5_spec
 (1.1.2)
  [   7] [Active ] [   ] [   10] Apache ServiceMix Specs :: JAXP
  API
  1.4 (1.2.0)
  [   8] [Active ] [Started] [   40] Apache ServiceMix Kernel ::
  GShell
  Core (1.1.0.SNAPSHOT)
  [   9] [Active ] [   ] [8] OPS4J Pax Logging - API (1.3.0)
  [  10] [Active ] [   ] [8] OPS4J Pax Logging - Service
  (1.3.0)
  [  11] [Active ] [   ] [5] OPS4J Pax Url - wrap: (0.3.3)
  [  12] [Active ] [   ] [5] OPS4J Pax Url - mvn: (0.3.3)
  [  13] [Active ] [   ] [   30] Apache ServiceMix Kernel :: JAAS
  Modules (1.1.0.SNAPSHOT)
  [  14] [Active ] [   ] [   30] Apache ServiceMix Kernel ::
  GShell
  Features (1.1.0.SNAPSHOT)
  [  15] [Active ] [   ] [   30] Apache ServiceMix Kernel ::
  GShell
  Admin (1.1.0.SNAPSHOT)
  [  16] [Active ] [   ] [   30] spring-osgi-io (1.2.0.m2)
  [  17] [Active ] [   ] [   30] Apache ServiceMix Bundles:
  mina-1.1.7
  (1.1.7.1)
  [  18] [Active ] [   ] [   30] Apache ServiceMix Kernel ::
  GShell
  PackageAdmin Commands (1.1.0.SNAPSHOT)
  [  19] [Active ] [   ] [   30] Apache ServiceMix Kernel ::
  GShell
  ConfigAdmin Commands (1.1.0.SNAPSHOT)
  [  20] [Active ] [Started] [   30] Apache ServiceMix Kernel ::
  GShell
  OSGi Commands (1.1.0.SNAPSHOT)
  [  21] [Active ] [   ] [   30] Spring Context (2.5.6)
  [  22] [Active ] [   ] [   30] Apache ServiceMix Bundles:
  commons-jexl-1.1 (1.1.0.1)
  [  23] [Active ] [Started] [   30] Apache ServiceMix Kernel :: JAAS
  Config (1.1.0.SNAPSHOT)
  [  24] [Active ] [   ] [   30] Apache ServiceMix Bundles:
  commons-httpclient-3.1 (3.1.0.1)
  [  25] [Active ] [   ] [   30] Spring Core (2.5.6)
  [  26] [Active ] [   ] [   30] jmx-impl (1.0.0.r6125-patched)
  [  27] [Active ] [   ] [   30] jmx (1.0.0.r6125-patched)
  [  28] [Active ] [Started] [   30] Apache ServiceMix Kernel ::
  GShell
  Log Commands (1.1.0.SNAPSHOT)
  [  29] [Active ] [   ] [   30] Apache ServiceMix Bundles:
  commons-vfs-1.0 (1.0.0.1)
  [  30] [Active ] [   ] [   30] Spring Beans (2.5.6)
  [  31] [Active ] [   ] [   30] Unnamed -
  com.google.code.sshd:sshd:bundle:0.1 (0.1)
  [  32] [Active ] [Started] [   30] Apache ServiceMix Kernel ::
  Management Core (1.1.0.SNAPSHOT)
  [  33] [Active ] [   ] [   30] Apache ServiceMix Bundles:
  commons-codec-1.2 (1.2.0.1)
  [  34] [Active ] [   ] [   30] spring-osgi-extender (1.2.0.m2)
  [  35] [Active ] [   ] [   30] Apache ServiceMix Bundles:
  cglib-2.1_3 (2.1.0.3_1)
  [  36] [Active ] [   ] [   30] Apache ServiceMix Bundles:
  jline-0.9.94 (0.9.94.1)
  [  37] [Active ] [   ] [   30] Apache ServiceMix Bundles:
  aopalliance-1.0 (1.0.0.1)
  [  38] [Active ] [   ] [   30] Spring AOP (2.5.6)
  [  39] [Active ] 

Re: MinaConfiguration codec property

2009-03-05 Thread Nicolas Bouillon
Thanks ! This way it works.

bean id=myCodec class=com.example.MyProtocolCodecFactory
/bean

bean id=myMinaFactory 
class=org.apache.camel.component.mina.MinaComponent
constructor-arg index=0 ref=camel /
/bean


bean id=myMinaEndpoint
  factory-bean=myMinaFactory
  factory-method=createEndpoint
constructor-arg index=0 ref=myMinaConfig/
/bean

bean depends-on=eppCodec id=myMinaConfig
class=org.apache.camel.component.mina.MinaConfiguration
property name=protocol value=tcp /
property name=host value=loclahost /
property name=port value= /
property name=sync value=true /
property name=codec value=myCodec /
/bean

On Thu, Mar 5, 2009 at 10:31, Willem Jiang willem.ji...@gmail.com wrote:
 Hi

 Since the myMinaEndpoint is created by the myMinaFactory which has not
 the reference from the application context which can be referred by the
 camelContext .
 So the myMinaEndpoint can't get find the instance of myCodec.

 My suggestion is adding a constructor-arg of the camel context under the
 bean id=myMinaFactory ...
 to let the myMinaFactory hold the reference of camelContext.

 Willem


 Nicolas Bouillon wrote:
 Hi,

 i've got an error when trying to create my mina endpoint with spring dsl :

       bean id=myCodec class=com.example.MyProtocolCodecFactory
       /bean

       bean id=myMinaFactory
 class=org.apache.camel.component.mina.MinaComponent/

       bean id=myMinaEndpoint
             factory-bean=myMinaFactory
             factory-method=createEndpoint
           constructor-arg index=0 ref=myMinaConfig/
       /bean

       bean id=myMinaConfig
 class=org.apache.camel.component.mina.MinaConfiguration
               property name=protocol value=tcp /
               property name=host value=localhost /
               property name=port value= /
               property name=sync value=true /
               property name=codec value=myCodec /
       /bean

 I got the following error :
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'myMinaEndpoint' defined in class path
 resource [spring.xml]: Instantiation of bean failed; nested exception
 is org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory method [public org.apache.camel.Endpoint
 org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.camel.component.mina.MinaConfiguration)
 throws java.lang.Exception] threw exception; nested exception is
 java.lang.NullPointerException
       at 
 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
       at java.security.AccessController.doPrivileged(Native Method)
       at 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
       at 
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
       at 
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
       at 
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
       at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
       at 
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
       at 
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
       at 
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
       at 
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
       at 
 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:139)
       at 
 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:83)
       at com.example.main(App.java:15)
 Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
 Factory 

Re: DSL Content Router interrupted with splitter() or multicast()

2009-03-05 Thread Claus Ibsen
On Thu, Mar 5, 2009 at 10:25 AM, ee7arh andrew.hu...@2e-systems.com wrote:

 Hi,

 When I tryto use the functions splitter() or multicast() in my DSL
 within a choice() block, I am not able to have another when() or even an
 otherwise()

 Predicate isInvitation
        = PredicateBuilder.regex(header(event_type), invitation);

 Predicate isReply
        = PredicateBuilder.regex(header(event_type), reply);

 from(jms:queue:myQueue)
 .choice()
    .when(isInvitation)
        .to(bean:eventMarshaller?methodName=unmarshallTriggerInvites)
        .splitter(body()) // This line causes a compilcation problem on the
 next when() or otherwise()
        .to(jms:queue:unmarshalledEventsQueue))
    .when(isFlightUpdate)

 If I take out the splitter() line above, all works fine and I can have as
 many when() statements as I like. Is there a reason why this doesn't work?
Yeah the compiler can not follow you :) When you mix like that in some
situations you get to a hold.

The solution is to split your route in sub routes. So keep one route
for the overall choice
And then sub routes for the splitter

You can use direct:xxx endpoints to connect them in sync fashion
and use seda:xxx for async fashion.



 Thanks
 Andrew


 --
 View this message in context: 
 http://www.nabble.com/DSL-Content-Router-interrupted-with-splitter%28%29-or-multicast%28%29-tp22347983p22347983.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Re: DSL Content Router interrupted with splitter() or multicast()

2009-03-05 Thread ee7arh

Thanks,

The only issue I now foresee by connecting sub-routes together by either
direct: or seda: is when I am trying to use transactions.

I am trying to build an application using Camel / ActiveMQ which can never
lose a message. My whole application is based arount the camel routing and I
want it so that no matter whether a message is being processed by bean or
sitting on a queue, it will never be lost in case of application going down.
The way I thought to do this was to pass messages from a persistent queue,
along to some beans, then landing again on a persistent queue all within a
PROPOGATION_REQUIRED transaction.

My understanding of what you wrote is that rather than using direct or
seda (which are not persistent), I would have to instead route to a jms
queue (persistent) to maintain my overall goal of never losing a message.
Could you comment whether I'm thinking along the right lines here? It's a
key assumption for my design so would hate to be going in totally the wrong
direction!

Regards
Andrew



ee7arh wrote:
 
 Hi,
 
 When I tryto use the functions splitter() or multicast() in my DSL
 within a choice() block, I am not able to have another when() or even
 an otherwise()
 
 Predicate isInvitation
 = PredicateBuilder.regex(header(event_type), invitation);
 
 Predicate isReply
 = PredicateBuilder.regex(header(event_type), reply);
 
 from(jms:queue:myQueue)
 .choice()
 .when(isInvitation)
 .to(bean:eventMarshaller?methodName=unmarshallTriggerInvites)
 .splitter(body()) // This line causes a compilcation problem on
 the next when() or otherwise()
 .to(jms:queue:unmarshalledEventsQueue))
 .when(isFlightUpdate)
 
 If I take out the splitter() line above, all works fine and I can have as
 many when() statements as I like. Is there a reason why this doesn't work?
 
 Thanks
 Andrew
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DSL-Content-Router-interrupted-with-splitter%28%29-or-multicast%28%29-tp22347983p22348709.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: camel-cxf AXIS2 on SMX4

2009-03-05 Thread cmoulliard

Guillaume,

Don't ask why but I have done today a clean reinstallation of my bundles and
now everything works fine without adding require-bundle.

Here is my list :

START LEVEL 100
   ID   State Spring Level  Name
[   0] [Active ] [   ] [0] System Bundle (1.5.0.SNAPSHOT)
[   1] [Active ] [   ] [   10] Apache Felix Prefrences Service
(1.0.2)
[   2] [Active ] [   ] [   10] geronimo-annotation_1.0_spec (1.1.1)
[   3] [Active ] [   ] [   10] OSGi R4 Compendium Bundle (4.1.0)
[   4] [Active ] [   ] [   10] Apache ServiceMix Bundles:
jaxp-ri-1.4.2 (1.4.2.1)
[   5] [Active ] [   ] [   10] Apache Felix Configuration Admin
Service (1.0.4)
[   6] [Active ] [   ] [   10] geronimo-servlet_2.5_spec (1.1.2)
[   7] [Active ] [   ] [   10] Apache ServiceMix Specs :: JAXP API
1.4 (1.2.0)
[   8] [Active ] [Started] [   40] Apache ServiceMix Kernel :: GShell
Core (1.1.0.SNAPSHOT)
[   9] [Active ] [   ] [8] OPS4J Pax Logging - API (1.3.0)
[  10] [Active ] [   ] [8] OPS4J Pax Logging - Service (1.3.0)
[  11] [Active ] [   ] [5] OPS4J Pax Url - wrap: (0.3.3)
[  12] [Active ] [   ] [5] OPS4J Pax Url - mvn: (0.3.3)
[  13] [Active ] [   ] [   30] Apache ServiceMix Kernel :: JAAS
Modules (1.1.0.SNAPSHOT)
[  14] [Active ] [   ] [   30] Apache ServiceMix Kernel :: GShell
Features (1.1.0.SNAPSHOT)
[  15] [Active ] [   ] [   30] Apache ServiceMix Kernel :: GShell
Admin (1.1.0.SNAPSHOT)
[  16] [Active ] [   ] [   30] spring-osgi-io (1.2.0.m2)
[  17] [Active ] [   ] [   30] Apache ServiceMix Bundles: mina-1.1.7
(1.1.7.1)
[  18] [Active ] [   ] [   30] Apache ServiceMix Kernel :: GShell
PackageAdmin Commands (1.1.0.SNAPSHOT)
[  19] [Active ] [   ] [   30] Apache ServiceMix Kernel :: GShell
ConfigAdmin Commands (1.1.0.SNAPSHOT)
[  20] [Active ] [Started] [   30] Apache ServiceMix Kernel :: GShell
OSGi Commands (1.1.0.SNAPSHOT)
[  21] [Active ] [   ] [   30] Spring Context (2.5.6)
[  22] [Active ] [   ] [   30] Apache ServiceMix Bundles:
commons-jexl-1.1 (1.1.0.1)
[  23] [Active ] [Started] [   30] Apache ServiceMix Kernel :: JAAS
Config (1.1.0.SNAPSHOT)
[  24] [Active ] [   ] [   30] Apache ServiceMix Bundles:
commons-httpclient-3.1 (3.1.0.1)
[  25] [Active ] [   ] [   30] Spring Core (2.5.6)
[  26] [Active ] [   ] [   30] jmx-impl (1.0.0.r6125-patched)
[  27] [Active ] [   ] [   30] jmx (1.0.0.r6125-patched)
[  28] [Active ] [Started] [   30] Apache ServiceMix Kernel :: GShell
Log Commands (1.1.0.SNAPSHOT)
[  29] [Active ] [   ] [   30] Apache ServiceMix Bundles:
commons-vfs-1.0 (1.0.0.1)
[  30] [Active ] [   ] [   30] Spring Beans (2.5.6)
[  31] [Active ] [   ] [   30] Unnamed -
com.google.code.sshd:sshd:bundle:0.1 (0.1)
[  32] [Active ] [Started] [   30] Apache ServiceMix Kernel ::
Management Core (1.1.0.SNAPSHOT)
[  33] [Active ] [   ] [   30] Apache ServiceMix Bundles:
commons-codec-1.2 (1.2.0.1)
[  34] [Active ] [   ] [   30] spring-osgi-extender (1.2.0.m2)
[  35] [Active ] [   ] [   30] Apache ServiceMix Bundles:
cglib-2.1_3 (2.1.0.3_1)
[  36] [Active ] [   ] [   30] Apache ServiceMix Bundles:
jline-0.9.94 (0.9.94.1)
[  37] [Active ] [   ] [   30] Apache ServiceMix Bundles:
aopalliance-1.0 (1.0.0.1)
[  38] [Active ] [   ] [   30] Spring AOP (2.5.6)
[  39] [Active ] [Started] [   30] Apache ServiceMix Kernel :: Spring
Deployer (1.1.0.SNAPSHOT)
[  40] [Active ] [   ] [   30] Apache ServiceMix Bundles: oro-2.0.8
(2.0.8.1)
[  41] [Active ] [   ] [   30] spring-osgi-core (1.2.0.m2)
[  42] [Active ] [   ] [   15] Apache ServiceMix Kernel :: File
Monitor (1.1.0.SNAPSHOT)
[  43] [Active ] [   ] [   60] Apache ServiceMix Specs :: JAXB API
2.1 (1.2.0)
[  44] [Active ] [   ] [   60] Apache ServiceMix Specs :: ACTIVATION
API 1.4 (1.2.0)
[  45] [Active ] [   ] [   60] camel-core (2.0.0.SNAPSHOT)
[  46] [Active ] [   ] [   60] geronimo-jta_1.1_spec (1.1.1)
[  47] [Active ] [   ] [   60] Spring Transaction (2.5.6)
[  48] [Active ] [   ] [   60] camel-spring (2.0.0.SNAPSHOT)
[  49] [Active ] [   ] [   60] camel-osgi (2.0.0.SNAPSHOT)
[  50] [Active ] [   ] [   60] camel-bindy (2.0.0.SNAPSHOT)
[  51] [Active ] [   ] [   60] Apache ServiceMix Bundles:
jaxb-impl-2.1.6 (2.1.6.1)
[  52] [Active ] [Started] [   60] Report Incident Domain Bundle
(1.0.0.SNAPSHOT)
[  53] [Active ] [Started] [   60] Report Incident Service Bundle
(1.0.0.SNAPSHOT)
[  54] [Active ] [Started] [   60] Report Incident Interfaces Bundle
(1.0.0.SNAPSHOT)
[  55] [Active ] [   ] [   60] Apache ServiceMix Bundles:
jetty-6.1.14 (6.1.14.1)
[  56] [Active ] [   ] [   60] OPS4J Pax Web - Web Container (0.4.1)
[  57] [Active ] [   ] [   

Re: Invoking web services with Camel Using CXF

2009-03-05 Thread Bruce Snyder
On Thu, Mar 5, 2009 at 9:46 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 However, it's invoking the web service twice - I'm seeing output from
 two invocations of the web service:

 sayHi called
 sayHi called

 Any idea why it's invoking it twice instead of just once?
 I have before been tricked by log4j if you have it defined twice as a
 appender. Could it be that?

 Or do you have 2 files in the folder?

No, I've only got one log4j.properties file as that's what the
archetype generated.

Interestingly, now both examples have stopped running because they're
hanging on the camel:dot generation:

Mar 5, 2009 9:55:00 AM org.apache.camel.util.MainSupport generateDot
INFO: Generating DOT file for routes:
/Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-one/target/site/cameldoc
for: org.apache.camel.spring.springcamelcont...@3e9fd8a7 with name:
camelContext

This is happening despite the fact that I've disabled it via the POM.

Bruce
-- 
perl -e 'print 
unpack(u30,D0G)u8...@4vyy95R\F)R=6-E+G-N61ED\!G;6%I;\YC;VT*
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/


Re: Invoking web services with Camel Using CXF

2009-03-05 Thread Claus Ibsen
On Thu, Mar 5, 2009 at 5:50 PM, Bruce Snyder bruce.sny...@gmail.com wrote:
 On Wed, Mar 4, 2009 at 10:55 PM, Claus Ibsen claus.ib...@gmail.com wrote:
 There is a setHeader tag you can use to add the header, just like
 the Java DSL below.
 It might use a expression as subtype so you need to wrap it with
 constant for string litterals

 Something like this:
 setHeader name=fooconstantBar/constant/setHeader

 Thanks, Claus. I missed this element in the XSD.


 The problem with this flavor is the following error:

 org.apache.camel.RuntimeCamelException: Can't find the operation name
 in the message!

 To my knowledge, there is no way to add headers to a message exchange
 via the XML. If I'm wrong about this I'd appreciate some suggestions
 on how to get beyond the error.


 2) Below is the same route using the Java API:

    public void configure() {
                from(file:src/data?noop=true).process(new Processor() {
            public void process(Exchange exchange) throws Exception {
                Message in = exchange.getIn();
                in.setHeader(operationName, sayHi);
            }
                }).
                
 to(cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld;);
        }

 The problem with this route is that Camel hangs on the following line
 indefinitely and I can't get it beyond it:

 ...
 INFO: Apache Camel 1.6.0 (CamelContext:camelContext) started
 Mar 4, 2009 2:01:06 PM org.apache.camel.util.MainSupport generateDot
 INFO: Generating DOT file for routes:
 /Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-two/target/site/cameldoc
 for: org.apache.camel.spring.springcamelcont...@dd6a83 with name:
 camelContext

 If anyone can tell me how to move beyond this then I could move on to
 the next issue.

 Incidentally, patched the org.apache.camel.spring.Main class to add
 the ability to disable the DOT file generation. But there is already a
 property in the RunMojo named dotEnabled but it's read-only. Why is
 this?
 Strange, as according to this you should be able to disable it:
 http://camel.apache.org/camel-dot-maven-goal.html

 I've now disabled this in the POM using the following configuration
 and it's still hanging in the same location:
If it is possible then I have fixed that in 1.6.1-SNAPSHOT or
2.0-SNAPSHOT by disabling DOT by default.

btw the parameter for camel:run is dotEnabled, where as its useDot for
camel:dot. I have aligned these names to useDot in 1.6.1 onwards.

Detecting if the EXEC hangs is kinda hard as its use some 3rd part
.jar to exec the Graphviz and wait for return codes. But in you case
it looks like something get it to struck. Im on Mac OS X as well and
have not seen this with Graphwiz.


  reporting
    plugins
      plugin
        groupIdorg.apache.camel/groupId
        artifactIdcamel-maven-plugin/artifactId
        version${camel-version}/version
        configuration
          
 !--executable/Applications/Graphviz.app/Contents/MacOS/Graphviz/executable--
          useDotfalse/useDot
        /configuration
      /plugin
    /plugins
  /reporting

 Maybe we should let it be disabled by default as most people will NOT
 have Graphviz installed by default.

 That's not a bad idea, but there should be some logging that indicates
 the situation, i.e., Unable to locate the Graphviz executable,
 disabling DOT generation.


 Additionally, I've enabled debug logging on org.apache.camel and I'm
 still only seeing info level output, even after cleaning and
 rebuilding.
 Have you added log4j to the classpath and log4j.properties in
 src/main/resources?

 CXF is sadly using JDK Logging (This is really terrible IMHO, always
 use JCL as all the other frameworks does)

 Willem Jiang wrote something somewhere how to get CXF to use log4j.

 Yeah, I'm aware of this as I added a tip to the CXF wiki some time ago:

 http://cwiki.apache.org/CXF20DOC/debugging.html#Debugging-UsingLog4jInsteadofjava.util.logging

 But this is not the issue. I'm no longer using the camel-cxf component
 and I still cannot see debug level logging.
Is this entire DEBUG logging or only for CXF? Camel uses commons logging.

BTW: Beware there re some commons logging .jars with no log4j
factories so if you grab one of the wrong ones it cannot log using
log4j.
Inside the .jar there should be a log4j class somewhere.

What about the examples that ships with Camel can you see debug
logging there? They use log4j and there is a log4j properties in
src/main/resources to tamper with.




 Bruce
 --
 perl -e 'print 
 unpack(u30,D0G)u8...@4vyy95R\F)R=6-E+G-N61ED\!G;6%I;\YC;VT*
 );'

 Apache ActiveMQ - http://activemq.apache.org/
 Apache Camel - http://camel.apache.org/
 Apache ServiceMix - http://servicemix.apache.org/

 Blog: http://bruceblog.org/




-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Re: Invoking web services with Camel Using CXF

2009-03-05 Thread Bruce Snyder
On Thu, Mar 5, 2009 at 9:59 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 If it is possible then I have fixed that in 1.6.1-SNAPSHOT or
 2.0-SNAPSHOT by disabling DOT by default.

Looks like it hasn't been deployed yet, so I'm having to build it locally.

 btw the parameter for camel:run is dotEnabled, where as its useDot for
 camel:dot. I have aligned these names to useDot in 1.6.1 onwards.

I tried the dotEnabled config and got this error:

Error configuring: org.apache.camel:camel-maven-plugin. Reason: ERROR:
Cannot override read-only parameter: dotEnabled in goal: camel:run



 Is this entire DEBUG logging or only for CXF? Camel uses commons logging.

This is only using Camel. I'm not using CXF.

 BTW: Beware there re some commons logging .jars with no log4j
 factories so if you grab one of the wrong ones it cannot log using
 log4j.
 Inside the .jar there should be a log4j class somewhere.

The project is using commons-logging-1.1 from the transitive
dependency via camel-core.

 What about the examples that ships with Camel can you see debug
 logging there? They use log4j and there is a log4j properties in
 src/main/resources to tamper with.

That's the weird thing - I can see all debug level logging with the
Camel examples.

Bruce
-- 
perl -e 'print 
unpack(u30,D0G)u8...@4vyy95R\F)R=6-E+G-N61ED\!G;6%I;\YC;VT*
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/


Re: Invoking web services with Camel Using CXF

2009-03-05 Thread Claus Ibsen
On Thu, Mar 5, 2009 at 6:42 PM, Bruce Snyder bruce.sny...@gmail.com wrote:
 On Thu, Mar 5, 2009 at 9:59 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 If it is possible then I have fixed that in 1.6.1-SNAPSHOT or
 2.0-SNAPSHOT by disabling DOT by default.

 Looks like it hasn't been deployed yet, so I'm having to build it locally.

 btw the parameter for camel:run is dotEnabled, where as its useDot for
 camel:dot. I have aligned these names to useDot in 1.6.1 onwards.

 I tried the dotEnabled config and got this error:

 Error configuring: org.apache.camel:camel-maven-plugin. Reason: ERROR:
 Cannot override read-only parameter: dotEnabled in goal: camel:run
Yeah that is a bommer with the @readonly. This is also fixed.




 Is this entire DEBUG logging or only for CXF? Camel uses commons logging.

 This is only using Camel. I'm not using CXF.

 BTW: Beware there re some commons logging .jars with no log4j
 factories so if you grab one of the wrong ones it cannot log using
 log4j.
 Inside the .jar there should be a log4j class somewhere.

 The project is using commons-logging-1.1 from the transitive
 dependency via camel-core.

 What about the examples that ships with Camel can you see debug
 logging there? They use log4j and there is a log4j properties in
 src/main/resources to tamper with.

 That's the weird thing - I can see all debug level logging with the
 Camel examples.
Can you try
   mvn dependency:list
to see if it got log4j in there.

Maybe compare it with the example that worked.



 Bruce
 --
 perl -e 'print 
 unpack(u30,D0G)u8...@4vyy95R\F)R=6-E+G-N61ED\!G;6%I;\YC;VT*
 );'

 Apache ActiveMQ - http://activemq.apache.org/
 Apache Camel - http://camel.apache.org/
 Apache ServiceMix - http://servicemix.apache.org/

 Blog: http://bruceblog.org/




-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Re: java.lang.NoClassDefFoundError when running CamelJmsToFileExample

2009-03-05 Thread m.s.

Thanks for the clarification, working with Camel in a Maven project in
NetBeans works great.
Unfortunately, I have to use it in an Ant build project, so I have to care
for resolving the dependencies myself. Is there a way to help me doing this
with Maven, e.g. by bundling all dependencies I need in a single archive?

M.S.



willem.jiang wrote:
 
 Yes. we don't ship all the dependencies in the binary distribution.
 Because Camel has lots of components if we ship all the dependency jars,
 the binary could be up to more than 100MB.
 
 Fortunately maven could help us to do that kind of work :)
 
 Willem
 m.s. wrote:
 Thanks, it works when I use Maven to download all the .jars listed in the
 dependency list and add them to the libraries in the NetBeans IDE.
 
 So is it correct that the binary distribution does not contain all
 dependencies if I use the JMS Component or aother component?
 
 M.S.
 
 
 

-- 
View this message in context: 
http://www.nabble.com/java.lang.NoClassDefFoundError-when-running-CamelJmsToFileExample-tp22341345p22359006.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



Re: Invoking web services with Camel Using CXF

2009-03-05 Thread Bruce Snyder
On Thu, Mar 5, 2009 at 9:31 AM, Bruce Snyder bruce.sny...@gmail.com wrote:

 Thanks for the advice, Willem. I incorrectly assumed that the
 camel-cxf module must be used to invoke a web service.

 The invocation is now working with the following route:

    route
      from uri=file:src/data?noop=true/
      to uri=http://localhost:9002/HelloWorld/
      to uri=log:HELLO_WORLD/
    /route

 However, it's invoking the web service twice - I'm seeing output from
 two invocations of the web service:

 sayHi called
 sayHi called

 Any idea why it's invoking it twice instead of just once?

Camel is still invoking the web service twice and I can't figure out
why? Even if I remove the call to the log. Any suggestions?

Bruce
-- 
perl -e 'print 
unpack(u30,D0G)u8...@4vyy95R\F)R=6-E+G-N61ED\!G;6%I;\YC;VT*
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/


Re: Invoking web services with Camel Using CXF

2009-03-05 Thread Bruce Snyder
On Thu, Mar 5, 2009 at 3:23 PM, Bruce Snyder bruce.sny...@gmail.com wrote:
 On Thu, Mar 5, 2009 at 9:31 AM, Bruce Snyder bruce.sny...@gmail.com wrote:

 Thanks for the advice, Willem. I incorrectly assumed that the
 camel-cxf module must be used to invoke a web service.

 The invocation is now working with the following route:

    route
      from uri=file:src/data?noop=true/
      to uri=http://localhost:9002/HelloWorld/
      to uri=log:HELLO_WORLD/
    /route

 However, it's invoking the web service twice - I'm seeing output from
 two invocations of the web service:

 sayHi called
 sayHi called

 Any idea why it's invoking it twice instead of just once?

 Camel is still invoking the web service twice and I can't figure out
 why? Even if I remove the call to the log. Any suggestions?


Nevermind, I figured it out.

Bruce
-- 
perl -e 'print 
unpack(u30,D0G)u8...@4vyy95R\F)R=6-E+G-N61ED\!G;6%I;\YC;VT*
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/


Re: java.lang.NoClassDefFoundError when running CamelJmsToFileExample

2009-03-05 Thread Claus Ibsen
On Thu, Mar 5, 2009 at 8:41 PM, m.s. mathis.schwuc...@web.de wrote:

 Thanks for the clarification, working with Camel in a Maven project in
 NetBeans works great.
 Unfortunately, I have to use it in an Ant build project, so I have to care
 for resolving the dependencies myself. Is there a way to help me doing this
 with Maven, e.g. by bundling all dependencies I need in a single archive?
You can use ivy that works with ANT and can find maven dependencies.

For maven you can run: mvn dependency:list to get a list what is needed.


 M.S.



 willem.jiang wrote:

 Yes. we don't ship all the dependencies in the binary distribution.
 Because Camel has lots of components if we ship all the dependency jars,
 the binary could be up to more than 100MB.

 Fortunately maven could help us to do that kind of work :)

 Willem
 m.s. wrote:
 Thanks, it works when I use Maven to download all the .jars listed in the
 dependency list and add them to the libraries in the NetBeans IDE.

 So is it correct that the binary distribution does not contain all
 dependencies if I use the JMS Component or aother component?

 M.S.




 --
 View this message in context: 
 http://www.nabble.com/java.lang.NoClassDefFoundError-when-running-CamelJmsToFileExample-tp22341345p22359006.html
 Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Re: Classloading and OSGI

2009-03-05 Thread willem.jiang

The patch is in trunk (Camel 2.0-SNAPSHOT) and 1.x branch (Camel
1.6.1-SNAPSHOT).
Please let me know if the error still bother you.

Willem


atlep wrote:
 
 No they don't..
 
 I peeked into the code that tries to load the QueueBrowserStrategy, and it
 seemt that it doesnt try the contextclasslaoder at all (I am using camel
 1.5.0), did i peek hard enough?
 
 Ideally one don't want to have references to packages other than
 camel-core, and let camel sort the refrences out. In osgi cases when the
 classloader is important one could have some explicit classloader
 configuration in camelContext..
 
 I will try to check the 2.0 fix, thank you for your help! :)
 
 
 willem.jiang wrote:
 
 
 I just want to ask a question, did your bundle has the import of
 org.apache.camel.component.jms.* ?
 
 If so, the ObjectHelper should be able to load the default
 QueueBrowserStrategy.
 
 Willem
 
 
 willem.jiang wrote:
 
 Hi ,  
 
 I just created a JIRA[1] for your issue.
 And will commit a quick fix for it.
 If you have time please check out the latest camel 2.0 snapshot to
 verify it.
 
 [1] https://issues.apache.org/activemq/browse/CAMEL-1412
 
 Willem
 
 
 atlep wrote:
 
 I am using camel in  a OSGI (Felix) environment, and I regularly bump
 into classloading issues:
 
 THe most recentones are
 The JSM Component cant find the QueueBrowserStrategy because it cannot
 see the spring bundle that exports it, because it is using a wrong 
 classloader to try to load it (it uses o.a.c.util.ObjectHelper's
 classloader).
 
 The activemq component cannot load object messages because it cannot
 deserialize the body. I have tried setting the thread
 contextclassloader to my bundles classloader, but it seems it does not
 use the context classloader.
 
 Are there any good practices or patterns regarding using camel +
 activemq in a OSGi environment, without resorting to servicemix? 
 
 Maybe these wrinkles are ironed out in camel 2.0?
 
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Classloading-and-OSGI-tp22303475p22367440.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.