camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CAMEL-494) CamelBeanPostProcessor.camelContext cannot be injected if SpringCamelContext is proxied (e.g. AOP)
Date Wed, 07 May 2008 04:26:43 GMT

     [ https://issues.apache.org/activemq/browse/CAMEL-494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen updated CAMEL-494:
------------------------------

    Description: 
Because CamelBeanPostProcessor.setCamelContext(SpringCamelContext) takes the class SpringCamelContext
as its parameter, bean initialization fails if SpringCamelContext is proxied.  The error is
as follows:

{code}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camelContext:beanPostProcessor':
Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException:
Failed to convert property value of type [$Proxy61] to required type [org.apache.camel.spring.SpringCamelContext]
for property 'camelContext'; nested exception is java.lang.IllegalArgumentException: Cannot
convert value of type [$Proxy61] to required type [org.apache.camel.spring.SpringCamelContext]
for property 'camelContext': no matching editors or conversion strategy found
{code}

In my project's Spring conf, we declare <aop:aspectj-autoproxy/>, which causes all Spring
beans to be proxied.  This triggers the problem shown above.  The problem should be reproducible
by adding <aop:aspectj-autoproxy/> to any Spring config that uses <camel:camelContext>.

The fix will be to separate the interface and class for SpringCamelContext, and use the interface
where appropriate.

  was:
Because CamelBeanPostProcessor.setCamelContext(SpringCamelContext) takes the class SpringCamelContext
as its parameter, bean initialization fails if SpringCamelContext is proxied.  The error is
as follows:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camelContext:beanPostProcessor':
Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException:
Failed to convert property value of type [$Proxy61] to required type [org.apache.camel.spring.SpringCamelContext]
for property 'camelContext'; nested exception is java.lang.IllegalArgumentException: Cannot
convert value of type [$Proxy61] to required type [org.apache.camel.spring.SpringCamelContext]
for property 'camelContext': no matching editors or conversion strategy found

In my project's Spring conf, we declare <aop:aspectj-autoproxy/>, which causes all Spring
beans to be proxied.  This triggers the problem shown above.  The problem should be reproducible
by adding <aop:aspectj-autoproxy/> to any Spring config that uses <camel:camelContext>.

The fix will be to separate the interface and class for SpringCamelContext, and use the interface
where appropriate.


Added code blocks.

Dean, Can you whirl together a small sample / preferred unit test that demonstrates this bug?
Would aid much during the fixing of the bug.

> CamelBeanPostProcessor.camelContext cannot be injected if SpringCamelContext is proxied
(e.g. AOP)
> --------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-494
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-494
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.3.0
>            Reporter: Dean Thompson
>             Fix For: 1.4.0
>
>
> Because CamelBeanPostProcessor.setCamelContext(SpringCamelContext) takes the class SpringCamelContext
as its parameter, bean initialization fails if SpringCamelContext is proxied.  The error is
as follows:
> {code}
> org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'camelContext:beanPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException:
Failed to convert property value of type [$Proxy61] to required type [org.apache.camel.spring.SpringCamelContext]
for property 'camelContext'; nested exception is java.lang.IllegalArgumentException: Cannot
convert value of type [$Proxy61] to required type [org.apache.camel.spring.SpringCamelContext]
for property 'camelContext': no matching editors or conversion strategy found
> {code}
> In my project's Spring conf, we declare <aop:aspectj-autoproxy/>, which causes
all Spring beans to be proxied.  This triggers the problem shown above.  The problem should
be reproducible by adding <aop:aspectj-autoproxy/> to any Spring config that uses <camel:camelContext>.
> The fix will be to separate the interface and class for SpringCamelContext, and use the
interface where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message