camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Gargan <steve.gar...@gmail.com>
Subject Re: Request message accessibility/manipulation
Date Fri, 15 Jan 2010 23:13:55 GMT
To narrow it down a little further, can you supply one of the stock
strategies to the route but leave the bean definition in place. It
would be interesting to see if it resolves when not used by camel.

Also try removing org.tempuri.MyAggregationStrategy from the manifest.

Did the route I suggested not work for you? it didn't require a custom
aggregator and might get you around this if you're in a hurry.

On Fri, Jan 15, 2010 at 2:41 PM, lekkie <lekkie.aydot@gmail.com> wrote:
>
>
> Thanks.
>
> Camel Version -> 2.1.0.psc-01-00RC1
> Osgi Container ->  Karaf
> Osgi version -> spring-osgi-core (1.2.0)
> camel-osgi -> (2.1.0.psc-01-00RC1)
>
> Bundle Manifest:
>
> Manifest-Version: 1.0
> Export-Package: org.tempuri;uses:="org.apache.camel,org.apache.camel.p
>  rocessor.aggregate"
> Built-By: lekkie
> Tool: Bnd-0.0.357
> Bundle-Name: Services :: Request Processor Bundle
> Created-By: Apache Maven Bundle Plugin
> Require-Bundle: org.apache.cxf.bundle
> Build-Jdk: 1.6.0_16
> Bundle-Version: 0.0.1.SNAPSHOT
> Bnd-LastModified: 1263566379826
> Bundle-ManifestVersion: 2
> Import-Package: META-INF.cxf,META-INF.cxf.transport.nmr,javax.jws;vers
>  ion="2.0",javax.wsdl,org.apache.camel;version="2.0",org.apache.camel.
>  processor.aggregate;version="2.0",org.apache.cxf.bus,org.apache.servi
>  cemix.camel.nmr,org.apache.servicemix.cxf.transport.nmr,org.apache.se
>  rvicemix.nmr.api,org.apache.servicemix.nmr.api.event,org.apache.servi
>  cemix.nmr.api.internal,org.springframework.beans.factory.config;versi
>  on="2.5",org.tempuri,org.tempuri.MyAggregationStrategy
> Bundle-SymbolicName: processor-bundle
>
>
>
>
> Stephen Gargan wrote:
>>
>> Can you give me some more info,such as the camel version and your osgi
>> container and version. The bundle manifest might not hurt either.
>>
>>
>> On Fri, Jan 15, 2010 at 10:01 AM, lekkie <lekkie.aydot@gmail.com> wrote:
>>>
>>> See attached trace, thanks.
>>>
>>> org.springframework.beans.factory.BeanCreationException: Error creating
>>> bean
>>> with name 'org.apache.cxf.bus.spring.BusApplicationListener' defined in
>>> OSGi
>>> resource[classpath:META-INF/cxf/cxf.xml|bnd.id=192|bnd.sym=kimono-processor-bundle]:
>>> Initialization of bean failed; nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Error creating
>>> bean
>>> with name 'camelContext': Invocation of init method failed; nested
>>> exception
>>> is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
>>> find class [org.tempuri.MyAggregationStrategy] for bean with name
>>> 'myAggregatorStrategy' defined in URL
>>> [bundleentry://192.fwk5195164/META-INF/spring/camel-context.xml]; nested
>>> exception is java.lang.ClassNotFoundException:
>>> org.tempuri.MyAggregationStrategy not found from bundle
>>> [kimono-processor-bundle]
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>>>        at
>>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>>>        at
>>> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
>>>        at
>>> org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:947)
>>>        at
>>> org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:701)
>>>        at
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1500(AbstractDelegatedExecutionApplicationContext.java:69)
>>>        at
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:351)
>>>        at
>>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>>>        at
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
>>>        at
>>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
>>>        at java.lang.Thread.run(Thread.java:595)
>>> Caused by: org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name 'camelContext': Invocation of init method failed;
>>> nested exception is
>>> org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
>>> find
>>> class [org.tempuri.MyAggregationStrategy] for bean with name
>>> 'myAggregatorStrategy' defined in URL
>>> [bundleentry://192.fwk5195164/META-INF/spring/camel-context.xml]; nested
>>> exception is java.lang.ClassNotFoundException:
>>> org.tempuri.MyAggregationStrategy not found from bundle
>>> [kimono-processor-bundle]
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>>>        at
>>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>>>        at
>>> org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:880)
>>>        at
>>> org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:88)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1331)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
>>>        ... 17 more
>>> Caused by:
>>> org.springframework.beans.factory.CannotLoadBeanClassException:
>>> Cannot find class [org.tempuri.MyAggregationStrategy] for bean with name
>>> 'myAggregatorStrategy' defined in URL
>>> [bundleentry://192.fwk5195164/META-INF/spring/camel-context.xml]; nested
>>> exception is java.lang.ClassNotFoundException:
>>> org.tempuri.MyAggregationStrategy not found from bundle
>>> [kimono-processor-bundle]
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1177)
>>>        at
>>> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:222)
>>>        at
>>> org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:937)
>>>        at
>>> org.apache.camel.spring.CamelContextFactoryBean.getBeanForType(CamelContextFactoryBean.java:539)
>>>        at
>>> org.apache.camel.spring.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:185)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
>>>        at
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
>>>        ... 31 more
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.tempuri.MyAggregationStrategy not found from bundle
>>> [kimono-processor-bundle]
>>>        at
>>> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
>>>        at
>>> org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>        at
>>> org.springframework.util.ClassUtils.forName(ClassUtils.java:211)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)
>>>        at
>>> org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)
>>>        ... 39 more
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.tempuri.MyAggregationStrategy
>>>        at
>>> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:448)
>>>        at
>>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
>>>        at
>>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
>>>        at
>>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>        at
>>> org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
>>>        at
>>> org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
>>>        at
>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
>>>        at
>>> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
>>>        ... 44 more
>>> 15:14:36,952 | INFO  | heckpoint Worker | MessageDatabase
>>>  |
>>> emq.store.kahadb.MessageDatabase  605 | Slow KahaDB access: cleanup took
>>> 561
>>>
>>>
>>>
>>>
>>>
>>> Stephen Gargan wrote:
>>>>
>>>> Hmm, You probably do export it's package correctly in the manifest,
>>>> though I know I've often forgotten to, is it correct? Could you post
>>>> the exception trace so we can have a look?
>>>>
>>>>
>>>> On Fri, Jan 15, 2010 at 6:46 AM, lekkie <lekkie.aydot@gmail.com> wrote:
>>>>>
>>>>> Thanks Stephen.
>>>>>
>>>>> I followed your sample snippet below.
>>>>>
>>>>> The wiretap was a success, however, I couldnt get through with the
>>>>> aggregator.
>>>>>
>>>>> It kept complaining class not found for my custom aggregator. See
>>>>> sample
>>>>> snippet below:
>>>>>
>>>>>  <osgi:camelContext xmlns="http://camel.apache.org/schema/spring"
>>>>> trace="true">
>>>>>
>>>>>   <package>org.tempuri</package>
>>>>>
>>>>>    <route>
>>>>>        <from uri="nmr:RequestProcessor" />
>>>>>        <wireTap uri="direct:ProcessorServices"/>
>>>>>        <!-- <to uri="log:TerminalManagerRequest"/>-->
>>>>>        <to
>>>>> uri="nmr:{http://services.locator/}ServicesService:ServicesPort"/>
>>>>>        <to uri="direct:ProcessorServices"/>
>>>>>    </route>
>>>>>
>>>>>    <route>
>>>>>        <from uri="direct:ProcessorServices" />
>>>>>        <aggregate strategyRef="myAggregatorStrategy" batchSize="2">
>>>>>                <correlationExpression>
>>>>>                        <constant>true</constant>
>>>>>                    </correlationExpression>
>>>>>                <to uri="log:Response"/>
>>>>>            </aggregate>
>>>>>    </route>
>>>>>
>>>>>  </osgi:camelContext>
>>>>>
>>>>>  <bean id="myAggregatorStrategy"
>>>>> class="org.tempuri.MyAggregationStrategy"/>
>>>>>
>>>>> </beans>
>>>>>
>>>>>
>>>>>
>>>>> I have the ffg in my project
>>>>>
>>>>> src/main/java/org/tempuri/MyAggregationStrategy.java
>>>>> src/main/resources/META-INF/spring/camel-context.xml
>>>>>
>>>>> And I can confirm the class is compiled with the bundle deployed.
>>>>>
>>>>> Any ideas?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Stephen Gargan wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> You can use Wiretaps and an aggregator to do what you're suggesting.
>>>>>> At each step that you want an intermediate result to be available,
>>>>>> wiretap it off to an aggregator and set the batch size of the
>>>>>> aggregator accordingly.
>>>>>>
>>>>>> from("direct:consumerEndpoint").wireTap("direct:aggregator").to("direct:requestToSomeEndpointTransformer").to(
>>>>>>                     "direct:someEndpoint").to("direct:aggregator");
>>>>>>
>>>>>> from("direct:aggregator").aggregate().header("id").batchSize(2).groupExchanges().to("mock:result");
>>>>>>
>>>>>> One thing to note is that groupExchanges() will gather up all the
>>>>>> aggregated exchanges and store them in a property in the exchange.
You
>>>>>> get at them via
>>>>>>
>>>>>> List<Exchange> grouped = e.getProperty(Exchange.GROUPED_EXCHANGE,
>>>>>> List.class);
>>>>>>
>>>>>> You'll need to write a custom processor (in place of the mock) to
>>>>>> combine/transform them to your liking as before responding. You can
>>>>>> find a bunch of info about aggregators here
>>>>>>
>>>>>> http://camel.apache.org/aggregator.html
>>>>>>
>>>>>> ste.
>>>>>>
>>>>>> On Thu, Jan 14, 2010 at 12:12 AM, lekkie <lekkie.aydot@gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi guys,
>>>>>>>
>>>>>>>
>>>>>>> Just a quick one. I have this scenario where I 'd like to manipulate
>>>>>>> a
>>>>>>> request and some reponse from an endpoint. The flow below describe
>>>>>>> what
>>>>>>> I
>>>>>>> am
>>>>>>> trying to achieve:
>>>>>>>
>>>>>>> <osgi:camelContext xmlns="http://camel.apache.org/schema/spring"
>>>>>>> trace="true">
>>>>>>>    <route>
>>>>>>>      <from uri="nmr:consumerEndpoint"/>
>>>>>>>      <to uri="xslt:requestToSomeEndpoint.xsl"/>
>>>>>>>      <to uri="nmr:someEndpoint"/>
>>>>>>>      <to uri="xslt:requestToAnotherEndpoint.xsl"/>
>>>>>>>      <to uri="nmr:anotherEndpoint"/>
>>>>>>>    </route>
>>>>>>> </camelcontext>
>>>>>>>
>>>>>>> I'd like the transformation (requestToAnotherEndpoint.xsl) to
be able
>>>>>>> to
>>>>>>> access/manipulate the original request message from
>>>>>>> nmr:consumerEndpoint
>>>>>>> and
>>>>>>> the response from nmr:someEndpoint in order to product its output.
>>>>>>>
>>>>>>> Is this scenario possible?
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://old.nabble.com/Request-message-accessibility-manipulation-tp27157259p27157259.html
>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Request-message-accessibility-manipulation-tp27157259p27178135.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Request-message-accessibility-manipulation-tp27157259p27181118.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Request-message-accessibility-manipulation-tp27157259p27184645.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message