camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: Question using OSGI / Bean / osgi:service
Date Thu, 06 May 2010 12:26:49 GMT
Hi,

I have found the error. I must use the syntax "beanRef" and not "bean"
in the javaDSL

Kind regards,

Charles Moulliard

Senior Enterprise Architect (J2EE, .NET, SOA)
Apache Camel Committer

*******************************************************************
- Blog : http://cmoulliard.blogspot.com
- Twitter : http://twitter.com/cmoulliard
- Linkedlin : http://www.linkedin.com/in/charlesmoulliard



On Thu, May 6, 2010 at 1:34 PM, Charles Moulliard <cmoulliard@gmail.com> wrote:
> Hi Willem,
>
> I get the same error if I use the syntax :
>
> .bean("com.goodyear.emea.gicl.esb.service.Persistence", "save")
>
> Caused by: org.apache.camel.component.bean.MethodNotFoundException:
> Method with name: save not found on bean:
> com.goodyear.emea.gicl.esb.service.Persistence. ...
>        at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:153)
>        at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:126)
>
> and this one
>
> Caused by: org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name
> 'com.goodyear.emea.gicl.esb.service.Persistence': Could not resolve
> matching constructor
>        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:238)
>        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
>
>  If I use the syntax :
>
> .bean(com.goodyear.emea.gicl.esb.service.Persistence.class, "save")
>
> Kind regards,
>
> Charles Moulliard
>
> Senior Enterprise Architect (J2EE, .NET, SOA)
> Apache Camel Committer
>
> *******************************************************************
> - Blog : http://cmoulliard.blogspot.com
> - Twitter : http://twitter.com/cmoulliard
> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
>
>
> On Thu, May 6, 2010 at 11:42 AM, Willem Jiang <willem.jiang@gmail.com> wrote:
>> Hi Charles,
>>
>> Maybe something is wrong with the OSGi service which is consumed within
>> Spring DM. I need to dig your test case for it.
>>
>> Can you try to using the interface name
>> "com.goodyear.emea.gicl.esb.service.Persistence" instead of "sapPersistence"
>> as the camel-bean's name ? As camel-osgi supports to access the OSGi service
>> within Camel context.
>>
>> Willem
>>
>>
>> Charles Moulliard wrote:
>>>
>>> Hi,
>>>
>>> I have created a camel Bean which is exposed as a spring DM service
>>>
>>> public interface Persistence {
>>>
>>>        public void save(@Body FinishedTireDocument finishedTiredDocument,
>>> Exchange ecxh);
>>>
>>> }
>>>
>>> public class PersistenceImpl implements Persistence {
>>>
>>>        private SapDocumentDAO sapDocumentDAO;
>>>
>>>        public void save(@Body FinishedTireDocument finishedTiredDocument,
>>> Exchange ecxh) {
>>>
>>>                getSapDocumentDAO().save(finishedTiredDocument);
>>>
>>>        }
>>>
>>>        public SapDocumentDAO getSapDocumentDAO() {
>>>                return sapDocumentDAO;
>>>        }
>>>
>>>        public void setSapDocumentDAO(SapDocumentDAO sapDocumentDAO) {
>>>                this.sapDocumentDAO = sapDocumentDAO;
>>>        }
>>>
>>> }
>>>
>>> Spring config
>>>
>>>        <bean id="sapServiceImpl"
>>> class="com.goodyear.emea.gicl.esb.service.impl.PersistenceImpl">
>>>                <property name="sapDocumentDAO">
>>>                        <osgi:reference
>>> interface="com.goodyear.emea.gicl.esb.persistence.SapDocumentDAO"/>
>>>                </property>
>>>        </bean>
>>>
>>>        <osgi:service ref="sapServiceImpl"
>>> interface="com.goodyear.emea.gicl.esb.service.Persistence"/>
>>>
>>> The service is called from a camel route like this :
>>>
>>>        public void configure() throws Exception {
>>>
>>>                /**
>>>                 * Route persisting objects in DB
>>>                 */
>>>                 from(queueValidatedUri)
>>>                 .bean("sapPersistence", "save")
>>>                 .to(queueValidatedUri);
>>>        }
>>>
>>> Spring config
>>>
>>>    <osgi:reference id="sapPersistence"
>>> interface="com.goodyear.emea.gicl.esb.service.Persistence"/>
>>>
>>> Unfortunately, I get this error.
>>>
>>> Caused by: org.apache.camel.component.bean.MethodNotFoundException:
>>> Method with name: save not found on bean: sapPersistence
>>>
>>> Is it allowed to exposed a camel bean like that ?
>>>
>>> Kind regards,
>>>
>>> Charles Moulliard
>>>
>>> Senior Enterprise Architect (J2EE, .NET, SOA)
>>> Apache Camel Committer
>>>
>>> *******************************************************************
>>> - Blog : http://cmoulliard.blogspot.com
>>> - Twitter : http://twitter.com/cmoulliard
>>> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>
>>
>>
>

Mime
View raw message