Hi The choice/when DSL is also in the Camel 1.3 spring. So I expect that you can do a 100% copy of the java dsl as spring dsl.
Check this URL to see which options you have in Spring for Camel 1.3.0 http://activemq.apache.org/camel/schema/spring/camel-spring-1.3.0.xsd Notice that the XSD returned here: http://activemq.apache.org/camel/schema/spring/camel-spring.xsd is outdated and should not be used. Med venlig hilsen Claus Ibsen ...................................... Silverbullet Skovsgårdsvænget 21 8362 Hørning Tlf. +45 2962 7576 Web: www.silverbullet.dk -----Original Message----- From: Daniel Nebot [mailto:[EMAIL PROTECTED] Sent: 9. juni 2008 12:25 To: [email protected] Subject: Re: Startup error. WhenType null pointer error Hi, Thanks for the answer. Still, with the <xpath>$foo = 'bar'</xpath> approach can one refer to the message headers ? I've tried it but only to get [Fatal Error] :1:1: Content is not allowed in prolog. Sure it is due to my message *not* being XML. Still, what I am trying to find is the XML conf equivalent to this kinda DSL(which already works) : from("activemq:QUEUE_HL7MGMADT_OUT"). to("activemq:QUEUE_ALLPGMADTS_IN"); from("activemq:QUEUE_ALLPGMADTS_OUT").choice(). when(header("msgAppFrom").isEqualTo("HOST1")). to("activemq:QUEUE_HL7MGMADT_IN"). otherwise(). to("activemq:QUEUE_HOSPITAL_IN"); Thanks in advance Daniel Willem Jiang <[EMAIL PROTECTED]> wrote: Here is an test[1] in the camel-spring unit test is same for your case :) The $foo = 'bar' is expression for checking the header foo isequals to bar. And this feature was added in Camel 1.3.0. [1]https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml Willem Daniel Nebot wrote: > Hi, > > I am very new to Camel and as soon as I have included a slightly more complex > route I got a NullPointerException. I will be very grateful if somebody could > have a look at the console output and point out any hints. > > The route is: > > > > > > > > > > > > > > > > > > > > > > > > The output is: > ACTIVEMQ_HOME: C:\Program Files\apache-activemq-5.1.0\bin\.. > ACTIVEMQ_BASE: C:\Program Files\apache-activemq-5.1.0\bin\.. > Loading message broker from: xbean:activemq.xml > INFO BrokerService - Using Persistence Adapter: > AMQPersistence > Adapter(C:\Program Files\apache-activemq-5.1.0\bin\..\data) > INFO BrokerService - ActiveMQ 5.1.0 JMS Message Broker > (localh > ost) is starting > INFO BrokerService - For help or more information please > see: > http://activemq.apache.org/ > INFO AMQPersistenceAdapter - AMQStore starting using directory: > C:\Pro > gram Files\apache-activemq-5.1.0\bin\..\data > INFO KahaStore - Kaha Store using data directory > C:\Progra > m Files\apache-activemq-5.1.0\bin\..\data\kr-store\state > INFO AMQPersistenceAdapter - Active data files: [1] > INFO KahaStore - Kaha Store using data directory > C:\Progra > m Files\apache-activemq-5.1.0\bin\..\data\kr-store\data > INFO TransportServerThreadSupport - Listening for connections at: > tcp://pc911 > 830016168:61616 > INFO TransportConnector - Connector openwire Started > INFO TransportServerThreadSupport - Listening for connections at: > ssl://pc911 > 830016168:61617 > INFO TransportConnector - Connector ssl Started > INFO TransportServerThreadSupport - Listening for connections at: > stomp://pc9 > 11830016168:61613 > INFO TransportConnector - Connector stomp Started > INFO TransportServerThreadSupport - Listening for connections at: > xmpp://pc91 > 1830016168:61222 > INFO TransportConnector - Connector xmpp Started > INFO NetworkConnector - Network Connector default-nc Started > INFO BrokerService - ActiveMQ JMS Message Broker > (localhost, I > D:pc911830016168-4261-1211802211218-0:0) started > INFO log - Logging to > org.slf4j.impl.JCLLoggerAdapte > r(org.mortbay.log) via org.mortbay.log.Slf4jLog > INFO log - jetty-6.1.9 > INFO WebConsoleStarter - ActiveMQ WebConsole initialized. > INFO /admin - Initializing Spring FrameworkServlet > 'dis > patcher' > INFO log - ActiveMQ Console at > http://0.0.0.0:8161/a > dmin > INFO log - ActiveMQ Web Demos at > http://0.0.0.0:8161 > /demo > INFO log - RESTful file access application at > http:/ > /0.0.0.0:8161/fileserver > INFO log - Started [EMAIL PROTECTED]:81 > 61 > ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: > java.la > ng.NullPointerException > java.lang.RuntimeException: Failed to execute start task. Reason: > java.lang.Null > PointerException > at > org.apache.activemq.console.command.StartCommand.runTask(StartCommand > .java:98) > at > org.apache.activemq.console.command.AbstractCommand.execute(AbstractC > ommand.java:57) > at > org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand > .java:129) > at > org.apache.activemq.console.command.AbstractCommand.execute(AbstractC > ommand.java:57) > at > org.apache.activemq.console.command.ShellCommand.main(ShellCommand.ja > va:79) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at org.apache.activemq.console.Main.runTaskClass(Main.java:222) > at org.apache.activemq.console.Main.main(Main.java:106) > Caused by: java.lang.NullPointerException > at > org.apache.camel.model.ExpressionNode.createFilterProcessor(Expressio > nNode.java:91) > at org.apache.camel.model.WhenType.createProcessor(WhenType.java:49) > at > org.apache.camel.model.ChoiceType.createProcessor(ChoiceType.java:57) > > at > org.apache.camel.model.ProcessorType.makeProcessor(ProcessorType.java > :1387) > at > org.apache.camel.model.ProcessorType.addRoutes(ProcessorType.java:95) > > at org.apache.camel.model.RouteType.addRoutes(RouteType.java:189) > at org.apache.camel.model.RouteType.addRoutes(RouteType.java:83) > at > org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(Defau > ltCamelContext.java:438) > at > org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext > .java:430) > at > org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext > .java:148) > at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47) > at > org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringC > amelContext.java:102) > at > org.springframework.context.event.SimpleApplicationEventMulticaster$1 > .run(SimpleApplicationEventMulticaster.java:78) > at > org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecut > or.java:49) > at > org.springframework.context.event.SimpleApplicationEventMulticaster.m > ulticastEvent(SimpleApplicationEventMulticaster.java:76) > at > org.springframework.context.support.AbstractApplicationContext.publis > hEvent(AbstractApplicationContext.java:260) > at > org.springframework.context.support.AbstractApplicationContext.finish > Refresh(AbstractApplicationContext.java:744) > at > org.springframework.context.support.AbstractApplicationContext.refres > h(AbstractApplicationContext.java:372) > at org.apache.xbean.spring.context.ResourceXmlApplicationContext.( > ResourceXmlApplicationContext.java:64) > at org.apache.xbean.spring.context.ResourceXmlApplicationContext.( > ResourceXmlApplicationContext.java:52) > at > org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext > (XBeanBrokerFactory.java:96) > at > org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBroker > Factory.java:52) > at > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j > ava:71) > at > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j > ava:54) > at > org.apache.activemq.console.command.StartCommand.startBroker(StartCom > mand.java:111) > at > org.apache.activemq.console.command.StartCommand.runTask(StartCommand > .java:73) > ... 10 more > ERROR: java.lang.Exception: java.lang.NullPointerException > java.lang.Exception: java.lang.NullPointerException > at > org.apache.activemq.console.command.StartCommand.runTask(StartCommand > .java:99) > at > org.apache.activemq.console.command.AbstractCommand.execute(AbstractC > ommand.java:57) > at > org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand > .java:129) > at > org.apache.activemq.console.command.AbstractCommand.execute(AbstractC > ommand.java:57) > at > org.apache.activemq.console.command.ShellCommand.main(ShellCommand.ja > va:79) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at org.apache.activemq.console.Main.runTaskClass(Main.java:222) > at org.apache.activemq.console.Main.main(Main.java:106) > Caused by: java.lang.NullPointerException > at > org.apache.camel.model.ExpressionNode.createFilterProcessor(Expressio > nNode.java:91) > at org.apache.camel.model.WhenType.createProcessor(WhenType.java:49) > at > org.apache.camel.model.ChoiceType.createProcessor(ChoiceType.java:57) > > at > org.apache.camel.model.ProcessorType.makeProcessor(ProcessorType.java > :1387) > at > org.apache.camel.model.ProcessorType.addRoutes(ProcessorType.java:95) > > at org.apache.camel.model.RouteType.addRoutes(RouteType.java:189) > at org.apache.camel.model.RouteType.addRoutes(RouteType.java:83) > at > org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(Defau > ltCamelContext.java:438) > at > org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext > .java:430) > at > org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext > .java:148) > at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47) > at > org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringC > amelContext.java:102) > at > org.springframework.context.event.SimpleApplicationEventMulticaster$1 > .run(SimpleApplicationEventMulticaster.java:78) > at > org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecut > or.java:49) > at > org.springframework.context.event.SimpleApplicationEventMulticaster.m > ulticastEvent(SimpleApplicationEventMulticaster.java:76) > at > org.springframework.context.support.AbstractApplicationContext.publis > hEvent(AbstractApplicationContext.java:260) > at > org.springframework.context.support.AbstractApplicationContext.finish > Refresh(AbstractApplicationContext.java:744) > at > org.springframework.context.support.AbstractApplicationContext.refres > h(AbstractApplicationContext.java:372) > at org.apache.xbean.spring.context.ResourceXmlApplicationContext.( > ResourceXmlApplicationContext.java:64) > at org.apache.xbean.spring.context.ResourceXmlApplicationContext.( > ResourceXmlApplicationContext.java:52) > at > org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext > (XBeanBrokerFactory.java:96) > at > org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBroker > Factory.java:52) > at > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j > ava:71) > at > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j > ava:54) > at > org.apache.activemq.console.command.StartCommand.startBroker(StartCom > mand.java:111) > at > org.apache.activemq.console.command.StartCommand.runTask(StartCommand > .java:73) > ... 10 more > > Cheers > Daniel >
