Hi I think you are stuck by the bug CAMEL-1663 that causes dependency injection with annotations to not work if you mix annotations from Camel with others. So use regular setter IoC using spring bean property to set the camel producer template.
You can try the 2.0m2 when it comes out with the fix, or the -SNAPSHOT version when its build by this time tomorrow. Details at the download page if using maven to get the SNAPSHOT http://camel.apache.org/download.html On Wed, Jun 3, 2009 at 12:53 PM, stevenmaring <steve.mar...@gmail.com> wrote: > > I tried putting the template inside the camelContext but it didn't seem to > help. I've now read thru a good chunk of the manual, which certainly did > wonders for my understanding of what is going on, but I'm still scratching > my head over this NullpointerException. The logs don't seem to be yelling > at me about anything ... > > 06:49:01,752 INFO ContextLoader:189 - Root WebApplicationContext: > initialization started > 06:49:01,862 INFO XmlWebApplicationContext:411 - Refreshing > org.springframework.web.context.support.xmlwebapplicationcont...@7eb6e2: > display name [Root WebApplicationContext]; startup date [Wed Jun 03 06:49:01 > EDT 2009]; root of context hierarchy > 06:49:02,018 INFO XmlBeanDefinitionReader:323 - Loading XML bean > definitions from ServletContext resource [/WEB-INF/applicationContext.xml] > 06:49:02,471 INFO XmlBeanDefinitionReader:323 - Loading XML bean > definitions from class path resource [META-INF/cxf/cxf.xml] > 06:49:02,596 INFO XmlBeanDefinitionReader:323 - Loading XML bean > definitions from class path resource [META-INF/cxf/cxf-extension-soap.xml] > 06:49:02,659 INFO XmlBeanDefinitionReader:323 - Loading XML bean > definitions from class path resource [META-INF/cxf/cxf-servlet.xml] > 06:49:04,659 INFO XmlWebApplicationContext:426 - Bean factory for > application context > [org.springframework.web.context.support.xmlwebapplicationcont...@7eb6e2]: > org.springframework.beans.factory.support.defaultlistablebeanfact...@baf589 > 06:49:05,034 INFO XmlWebApplicationContext:1196 - Bean 'cxf' is not > eligible for getting processed by all BeanPostProcessors (for example: not > eligible for auto-proxying) > 06:49:05,112 INFO DefaultCamelContext:120 - JMX enabled. Using > InstrumentationLifecycleStrategy. > 06:49:05,143 DEBUG CamelContextFactoryBean:282 - Found JAXB created routes: > [] > 06:49:05,159 INFO XmlWebApplicationContext:1196 - Bean 'camel' is not > eligible for getting processed by all BeanPostProcessors (for example: not > eligible for auto-proxying) > 06:49:05,159 INFO XmlWebApplicationContext:1196 - Bean 'camel' is not > eligible for getting processed by all BeanPostProcessors (for example: not > eligible for auto-proxying) > 06:49:05,206 INFO DefaultListableBeanFactory:414 - Pre-instantiating > singletons in > org.springframework.beans.factory.support.defaultlistablebeanfact...@baf589: > defining beans > [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,camelTemplate,camel:beanPostProcessor,camel,imq,voiceGenerator,imqConnectionFactory,voiceGeneratorWS]; > root of factory hierarchy > 06:49:07,424 DEBUG SpringCamelContext:107 - Publishing spring-event: > org.springframework.context.event.contextrefreshedevent[source=org.springframework.web.context.support.xmlwebapplicationcont...@7eb6e2: > display name [Root WebApplicationContext]; startup date [Wed Jun 03 06:49:01 > EDT 2009]; root of context hierarchy] > 06:49:07,424 DEBUG SpringCamelContext:94 - Starting the CamelContext now > that the ApplicationContext has started > 06:49:07,424 INFO DefaultCamelContext:729 - Apache Camel 2.0-M1 > (CamelContext:camel) is starting > 06:49:07,440 DEBUG DefaultInstrumentationAgent:183 - Starting JMX agent on > server: com.sun.jmx.mbeanserver.jmxmbeanser...@e7bb91 > 06:49:07,534 DEBUG DefaultInstrumentationAgent:247 - Registered MBean with > objectname: org.apache.camel:context=smaring-dt/camel,name=context > 06:49:07,549 INFO DefaultCamelContext:771 - Apache Camel 2.0-M1 > (CamelContext:camel) started > 06:49:07,565 DEBUG DefaultComponent:77 - Creating endpoint > uri=[spring-event:default], path=[default], parameters=[{}] > 06:49:07,565 DEBUG DefaultCamelContext:362 - spring-event:default converted > to endpoint: Endpoint[spring-event:default] by component: > org.apache.camel.component.event.eventcompon...@1f4cf6f > 06:49:07,581 DEBUG DefaultInstrumentationAgent:247 - Registered MBean with > objectname: > org.apache.camel:context=smaring-dt/camel,type=endpoints,name="spring-event:default\?id=0x20a20c46" > 06:49:07,706 INFO ContextLoader:209 - Root WebApplicationContext: > initialization completed in 5938 ms > 06:49:07,737 INFO BusApplicationContext:411 - Refreshing > org.apache.cxf.bus.spring.busapplicationcont...@1a1b2f: display name > [org.apache.cxf.bus.spring.busapplicationcont...@1a1b2f]; startup date [Wed > Jun 03 06:49:07 EDT 2009]; parent: > org.springframework.web.context.support.xmlwebapplicationcont...@7eb6e2 > 06:49:07,815 INFO BusApplicationContext:426 - Bean factory for application > context [org.apache.cxf.bus.spring.busapplicationcont...@1a1b2f]: > org.springframework.beans.factory.support.defaultlistablebeanfact...@6f4652 > 06:49:07,893 INFO DefaultListableBeanFactory:414 - Pre-instantiating > singletons in > org.springframework.beans.factory.support.defaultlistablebeanfact...@6f4652: > defining beans []; parent: > org.springframework.beans.factory.support.defaultlistablebeanfact...@baf589 > 06:49:07,909 DEBUG SpringCamelContext:107 - Publishing spring-event: > org.springframework.context.event.contextrefreshedevent[source=org.apache.cxf.bus.spring.busapplicationcont...@1a1b2f: > display name [org.apache.cxf.bus.spring.busapplicationcont...@1a1b2f]; > startup date [Wed Jun 03 06:49:07 EDT 2009]; parent: > org.springframework.web.context.support.xmlwebapplicationcont...@7eb6e2] > 06:49:07,909 DEBUG SpringCamelContext:94 - Starting the CamelContext now > that the ApplicationContext has started > > > I'm going to try a simple HelloWorld sort of project getting a reference to > the ProducerTemplate ala ... > > mvn archetype:generate \ > -DarchetypeGroupId=org.apache.camel.archetypes \ > -DarchetypeArtifactId=camel-archetype-spring \ > -DarchetypeVersion=2.0-M1 \ > -DgroupId=my.sample \ > -DartifactId=HelloCamel > > hopefully I will either learn something or not get the NullpointerException > on my reference. > > I'll let ya'll know how it goes ... thank you much for your thoughts so far > > -Steve Maring > > > Martin Gilday wrote: >> >> Sorry if this appears twice, my first attempt got rejected as spam :) >> >> Claus, >> Do you have to put the template inside the context? Is this a 2.0 >> change? I've always placed it outside. As you can't define a context >> ref it seemed effectively singleton and so didn't matter where you >> created it. This is also how I wrote it in the Camel Spring tutorial on >> the wiki. If it is considereed incorrect then I can update it. >> >> Thanks, >> Martin >> >> >> ----- Original message ----- >> From: "Claus Ibsen" <claus.ib...@gmail.com> >> To: users@camel.apache.org >> Date: Wed, 3 Jun 2009 06:22:30 +0200 >> Subject: Re: using ProducerTemplate for JMS with Spring >> >> >> Hi welcome on board the Camel ride. >> >> You almost got it. The camel:template XML tag should be inside the >> camel:context XML tag. So it should be: >> >> <camel:camelContext id="camel"> >> <camel:template id="camelTemplate"/> >> </camel:camelContext> >> >> > > -- > View this message in context: > http://www.nabble.com/using-ProducerTemplate-for-JMS-with-Spring-tp23840855p23849357.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/ Twitter: http://twitter.com/davsclaus