yeah ... I fought with my local Archiva repo for quite some time yesterday
because it didn't seem to be proxying the SNAPSHOT requests onto the Apache
snapshot repo, so I manually inserted the 2.0-SNAPSHOT releases into my
Archiva repo.

well ... with regard to this issue I'm having I'm not sure whether to put my
fist through the screen or curl up in the corner and cry like a baby ...
I've been fighting this for 3 days (on little sleep) and I'm supposed to
demo something with a code review in 7 hours!!!!  I thought it would be cool
if I could show how I could make this company's life easier with Camel ...
it won't look good for Camel (in the eyes of my company) or ME (in this
economy as a contractor) if I can't get something working very soon.

I've given up on trying to inject a handle to the ProducerTemplate into my
class since, given the CamelContext, I can easily create one
programmatically.  So now, my only concern is how to get a handle to the
CamelContext into my POJO.

I can see the context start in the logs, but it seems no matter what I try I
cannot get my CamelContext property set.  It is always null.

<camel:camelContext id="camel"/>

<bean id="myBean" class="sample.MyBean">
   <property name="context" ref="camel"/>
</bean>

where MyBean is also a jaxws webservice.  I've tried to instrument helper
classes instead of this pojo directly.  I've tried various versions of Camel
and every possible combination of namespaces I can think of.  I suppose next
I will try creating a CamelManager class that starts the context manually
and builds the routes, remove all refs to camel from my spring config, and
inject my pojo with that. ... oh, and pray like hell!   I know the powers
that be are not going to be too thrilled with a hack though.

I'm sooooo frustrated right now = (



Claus Ibsen-2 wrote:
> 
> On Thu, Jun 4, 2009 at 5:26 AM, stevenmaring <steve.mar...@gmail.com>
> wrote:
>>
>> Clause,
>>
>> I just tried the 2.0-SNAPSHOT released earlier today and got the same
>> thing.
> There is something wrong with the Apache snapshot maven repo. Its
> maven metadata is wrong.
> It wrongly says the last version is a version from 9th april.
> 
> You can get a fresh version by downloading the .jar yourself and
> install to your local .m2 repo.
> Or build the source and install locally.
> 
> 
>>
>> May I ask for a specific example of what you mean by "use regular setter
>> IoC
>> using spring bean property to set the camel producer template"?
> 
> Yes its using the spring bean XML wiring
> 
> <bean id="foo" class=...>
>    <property name="myprop" ref="bar"/>
> </bean>
> 
> <bean id="bar" class=.../>
> 
> In the camel context you give the <camelTemplate> and id so its
> <camelTemplate id="template"/>
> 
> And then ref to this id from your POJO class.
> 
> 
> 
>>
>> Thanks,
>> Steve Maring
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> 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
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/using-ProducerTemplate-for-JMS-with-Spring-tp23840855p23863267.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
> 
> 

-- 
View this message in context: 
http://www.nabble.com/using-ProducerTemplate-for-JMS-with-Spring-tp23840855p23866699.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to