You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by umairt <um...@gmail.com> on 2010/04/08 09:51:08 UTC

Move to Spring 3.0

Hi,


I am trying to shift my project(currently using Camel2.2.0 and Spring 2.5)
to spring 3.0. I have changed the spring version to 3 but I am getting the
following stack trace:

 orCaused by: java.lang.NullPointerException
	at org.apache.camel.impl.ProducerCache.<init>(ProducerCache.java:52)
	at
org.apache.camel.impl.DefaultProducerTemplate.<init>(DefaultProducerTemplate.java:57)
	at
org.apache.camel.spring.CamelProducerTemplateFactoryBean.getObject(CamelProducerTemplateFactoryBean.java:74)
	at
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)

After I debugged it I found something very strange in
CamelProducerTemplateFactoryBean. The getObject method is being called
before afterPropertiesSet method is called. That is why camel context is
uninitialized and hence the null pointer exception. I was wondering how this
could happen in Spring or am I missing some camel configuration for spring
3.0?


Umair
-- 
View this message in context: http://old.nabble.com/Move-to-Spring-3.0-tp28175300p28175300.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Move to Spring 3.0

Posted by Norman Maurer <no...@googlemail.com>.
I'm using camel 2.2.0 with spring 3.0.0 without any problems here.
Here is the relevant spring config:


    <!-- Change trace to true for debugging purposes -->
    <camel:camelContext id="jamesCamelContext" trace="false" >
        <camel:jmxAgent id="agent" disabled="true"/>
        <camel:template id="producerTemplate"/>
        <camel:routeBuilder ref="processorRoute" />
    </camel:camelContext>

In my pom.xml I use this:

  <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
      <version>2.2.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-spring</artifactId>
      <version>2.2.0</version>
      <scope>runtime</scope>
      <exclusions>
        <exclusion>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

As you see I exclude spring-web. Maybe you don't exclude it and so it
pull a "old" spring version and so something get mixed..

Bye,
Norman


2010/4/8 Willem Jiang <wi...@gmail.com>:
> Can you create a JIRA with a small test case to show the error?
> We did run the test with Spring 3.0.0 before Camel 2.2.0 released.
>
> BTW, can you try the latest released Spring 3.0.2.RELEASE to check if the
> error still there?
>
> Willem
>
> umairt wrote:
>>
>> Hi,
>>
>>
>> I am trying to shift my project(currently using Camel2.2.0 and Spring 2.5)
>> to spring 3.0. I have changed the spring version to 3 but I am getting the
>> following stack trace:
>>
>>  orCaused by: java.lang.NullPointerException
>>        at
>> org.apache.camel.impl.ProducerCache.<init>(ProducerCache.java:52)
>>        at
>>
>> org.apache.camel.impl.DefaultProducerTemplate.<init>(DefaultProducerTemplate.java:57)
>>        at
>>
>> org.apache.camel.spring.CamelProducerTemplateFactoryBean.getObject(CamelProducerTemplateFactoryBean.java:74)
>>        at
>>
>> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
>>
>> After I debugged it I found something very strange in
>> CamelProducerTemplateFactoryBean. The getObject method is being called
>> before afterPropertiesSet method is called. That is why camel context is
>> uninitialized and hence the null pointer exception. I was wondering how
>> this
>> could happen in Spring or am I missing some camel configuration for spring
>> 3.0?
>>
>>
>> Umair
>
>

Re: Move to Spring 3.0

Posted by Willem Jiang <wi...@gmail.com>.
Can you create a JIRA with a small test case to show the error?
We did run the test with Spring 3.0.0 before Camel 2.2.0 released.

BTW, can you try the latest released Spring 3.0.2.RELEASE to check if 
the error still there?

Willem

umairt wrote:
> Hi,
> 
> 
> I am trying to shift my project(currently using Camel2.2.0 and Spring 2.5)
> to spring 3.0. I have changed the spring version to 3 but I am getting the
> following stack trace:
> 
>  orCaused by: java.lang.NullPointerException
> 	at org.apache.camel.impl.ProducerCache.<init>(ProducerCache.java:52)
> 	at
> org.apache.camel.impl.DefaultProducerTemplate.<init>(DefaultProducerTemplate.java:57)
> 	at
> org.apache.camel.spring.CamelProducerTemplateFactoryBean.getObject(CamelProducerTemplateFactoryBean.java:74)
> 	at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
> 
> After I debugged it I found something very strange in
> CamelProducerTemplateFactoryBean. The getObject method is being called
> before afterPropertiesSet method is called. That is why camel context is
> uninitialized and hence the null pointer exception. I was wondering how this
> could happen in Spring or am I missing some camel configuration for spring
> 3.0?
> 
> 
> Umair


RE: Move to Spring 3.0

Posted by "Pitre, Russell" <RP...@shawmut.com>.
+1

-----Original Message-----
From: Dragisa Krsmanovic [mailto:dkrsmanovic@plos.org] 
Sent: Thursday, April 08, 2010 1:29 PM
To: users@camel.apache.org
Subject: Re: Move to Spring 3.0

We run our Camel 2.2.0 app with Spring 3.0 (3.0.1 and 3.0.2 now) without
problems.


On Thu, 2010-04-08 at 00:51 -0700, umairt wrote:
> Hi,
> 
> 
> I am trying to shift my project(currently using Camel2.2.0 and Spring 2.5)
> to spring 3.0. I have changed the spring version to 3 but I am getting the
> following stack trace:
> 
>  orCaused by: java.lang.NullPointerException
> 	at org.apache.camel.impl.ProducerCache.<init>(ProducerCache.java:52)
> 	at
> org.apache.camel.impl.DefaultProducerTemplate.<init>(DefaultProducerTemplate.java:57)
> 	at
> org.apache.camel.spring.CamelProducerTemplateFactoryBean.getObject(CamelProducerTemplateFactoryBean.java:74)
> 	at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
> 
> After I debugged it I found something very strange in
> CamelProducerTemplateFactoryBean. The getObject method is being called
> before afterPropertiesSet method is called. That is why camel context is
> uninitialized and hence the null pointer exception. I was wondering how this
> could happen in Spring or am I missing some camel configuration for spring
> 3.0?
> 
> 
> Umair

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This email is confidential to the intended recipient. If you have received it in error, please notify the sender and delete it from your
system. Any unauthorized use, disclosure or copying is not permitted. The views or opinions presented are solely those of the sender and do
not necessarily represent those of Public Library of Science unless otherwise specifically stated. Please note that neither Public Library
of Science nor any of its agents accept any responsibility for any viruses that may be contained in this e-mail or its attachments and it
is your responsibility to scan the e-mail and attachments (if any).

Re: Move to Spring 3.0

Posted by Dragisa Krsmanovic <dk...@plos.org>.
We run our Camel 2.2.0 app with Spring 3.0 (3.0.1 and 3.0.2 now) without
problems.


On Thu, 2010-04-08 at 00:51 -0700, umairt wrote:
> Hi,
> 
> 
> I am trying to shift my project(currently using Camel2.2.0 and Spring 2.5)
> to spring 3.0. I have changed the spring version to 3 but I am getting the
> following stack trace:
> 
>  orCaused by: java.lang.NullPointerException
> 	at org.apache.camel.impl.ProducerCache.<init>(ProducerCache.java:52)
> 	at
> org.apache.camel.impl.DefaultProducerTemplate.<init>(DefaultProducerTemplate.java:57)
> 	at
> org.apache.camel.spring.CamelProducerTemplateFactoryBean.getObject(CamelProducerTemplateFactoryBean.java:74)
> 	at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
> 
> After I debugged it I found something very strange in
> CamelProducerTemplateFactoryBean. The getObject method is being called
> before afterPropertiesSet method is called. That is why camel context is
> uninitialized and hence the null pointer exception. I was wondering how this
> could happen in Spring or am I missing some camel configuration for spring
> 3.0?
> 
> 
> Umair

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This email is confidential to the intended recipient. If you have received it in error, please notify the sender and delete it from your
system. Any unauthorized use, disclosure or copying is not permitted. The views or opinions presented are solely those of the sender and do
not necessarily represent those of Public Library of Science unless otherwise specifically stated. Please note that neither Public Library
of Science nor any of its agents accept any responsibility for any viruses that may be contained in this e-mail or its attachments and it
is your responsibility to scan the e-mail and attachments (if any).