Hi Willem,

I will make a test but I think that if I use package name
"com.goodyear.emea.gicl.esb.service.Persistence" instead of the spring
ref, camel will instantiate an object locally and in this case, it
will not aware of the spring injection !!

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.ji...@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
>>
>
>

Reply via email to