So, I was able to make *something* work.

I ended up getting things to work using a blueprint.xml.  Not sure why it
suddenly started working, but I decided to not question lady luck.

The key was to create a bean, which I called FooHolder.  I injected a
property into this bean that referenced the CamelContext.  Then I simply
provided that object with some static methods that did the routing.  For a
prototype, it's ok, but I don't think this is the way it should work.
 Anyone who has some opinions or best practices, I am all eyes and fingers.

John


On Sun, Jun 30, 2013 at 3:38 PM, John D. Ament <[email protected]>wrote:

> for what it's worth, this is what happens when I try it on the spring
> side.  I did check, activemq is listed as an import package in the manifest
> file (this happens in both 4.5.1 and 4.5.2 snapshot).
>
> 2013-06-30 15:35:44,635 | ERROR | ExtenderThread-1 | ContextLoaderListener
>            | 82 - org.springframework.osgi.extender - 1.2.1 | Application
> context refresh failed
> (OsgiBundleXmlApplicationContext(bundle=servicemix-cxf,
> config=osgibundle:/META-INF/spring/*.xml))
> org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected
> exception parsing XML document from URL
> [bundle://182.0:0/META-INF/spring/camel-cxf.xml]; nested exception is
> java.lang.IllegalArgumentException: Could not load property editor:
> org.apache.activemq.util.BooleanEditor
>  at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)[71:org.springframework.beans:3.0.7.RELEASE]
> at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:164)[79:org.springframework.osgi.core:1.2.1]
>  at
> org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:136)[79:org.springframework.osgi.core:1.2.1]
>  at
> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)[73:org.springframework.context:3.0.7.RELEASE]
>  at
> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)[73:org.springframework.context:3.0.7.RELEASE]
>  at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:69)[79:org.springframework.osgi.core:1.2.1]
>  at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:269)[79:org.springframework.osgi.core:1.2.1]
>  at
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[79:org.springframework.osgi.core:1.2.1]
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)[79:org.springframework.osgi.core:1.2.1]
>  at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:214)[82:org.springframework.osgi.extender:1.2.1]
>  at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:169)[82:org.springframework.osgi.extender:1.2.1]
>  at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)[79:org.springframework.osgi.core:1.2.1]
>  at
> org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:716)[82:org.springframework.osgi.extender:1.2.1]
>  at java.lang.Thread.run(Thread.java:722)[:1.7.0_21]
> Caused by: java.lang.IllegalArgumentException: Could not load property
> editor: org.apache.activemq.util.BooleanEditor
>  at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.createPropertyEditor(XBeanNamespaceHandler.java:469)[84:org.apache.xbean.spring:3.11.1]
> at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.getValue(XBeanNamespaceHandler.java:444)[84:org.apache.xbean.spring:3.11.1]
>  at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.addProperty(XBeanNamespaceHandler.java:415)[84:org.apache.xbean.spring:3.11.1]
> at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.addAttributeProperty(XBeanNamespaceHandler.java:404)[84:org.apache.xbean.spring:3.11.1]
>  at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.addAttributeProperties(XBeanNamespaceHandler.java:337)[84:org.apache.xbean.spring:3.11.1]
> at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:225)[84:org.apache.xbean.spring:3.11.1]
>  at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:276)[84:org.apache.xbean.spring:3.11.1]
> at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:156)[84:org.apache.xbean.spring:3.11.1]
>  at
> org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:49)[84:org.apache.xbean.spring:3.11.1]
> at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1338)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1328)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)[71:org.springframework.beans:3.0.7.RELEASE]
>  at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)[71:org.springframework.beans:3.0.7.RELEASE]
>  ... 18 more
> Caused by: java.lang.ClassNotFoundException:
> org.apache.activemq.util.BooleanEditor not found from bundle
> [servicemix-cxf]
> at
> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)[79:org.springframework.osgi.core:1.2.1]
>  at
> org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)[79:org.springframework.osgi.core:1.2.1]
> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_21]
>  at
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.createPropertyEditor(XBeanNamespaceHandler.java:467)[84:org.apache.xbean.spring:3.11.1]
> ... 32 more
> Caused by: java.lang.ClassNotFoundException:
> org.apache.activemq.util.BooleanEditor not found by servicemix-cxf [182]
> at
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)[org.apache.felix.framework-3.2.2.jar:]
>  at
> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)[org.apache.felix.framework-3.2.2.jar:]
> at
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1807)[org.apache.felix.framework-3.2.2.jar:]
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_21]
> at
> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:670)[org.apache.felix.framework-3.2.2.jar:]
>  at
> org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1654)[org.apache.felix.framework-3.2.2.jar:]
> at
> org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:909)[org.apache.felix.framework-3.2.2.jar:]
>  at
> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)[79:org.springframework.osgi.core:1.2.1]
> ... 35 more
>
>
> On Sat, Jun 29, 2013 at 8:10 PM, John D. Ament <[email protected]>wrote:
>
>> So, I'll start by responding to my own email :-)
>>
>> After digging through some examples this afternoon, I did find one where
>> if the result is a static piece of text back to the client based on the web
>> service being called.  So I started playing with that to see if I could get
>> activemq working in it.
>>
>> The problem I seem to have is around osgi class loading.  I created a
>> sample project up on github to see what I've done
>> https://github.com/johnament/servicemix-cxf
>>
>> Right now there are two directories, META-INF Is where the spring config
>> is located, OSGI-INF for the blueprint files.
>>
>> I am essentially trying to get a listener on the cxf runtime, but when I
>> try running it I get an error:
>>
>> used by: org.apache.camel.NoSuchBeanException: Found bean: orderEndpoint
>> in BlueprintContainer:
>> org.apache.aries.blueprint.container.BlueprintContainerImpl@6b6c1329 of
>> type: org.apache.cxf.jaxws.EndpointImpl expected type was: class
>> org.apache.camel.component.cxf.CxfEndpoint
>>  at
>> org.apache.camel.blueprint.BlueprintContainerRegistry.lookup(BlueprintContainerRegistry.java:62)[99:org.apache.camel.camel-blueprint:2.10.4]
>> at
>> org.apache.camel.impl.CompositeRegistry.lookup(CompositeRegistry.java:49)[96:org.apache.camel.camel-core:2.10.4]
>>  at
>> org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:62)[96:org.apache.camel.camel-core:2.10.4]
>> at
>> org.apache.camel.util.CamelContextHelper.lookup(CamelContextHelper.java:108)[96:org.apache.camel.camel-core:2.10.4]
>>  at
>> org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:128)[96:org.apache.camel.camel-core:2.10.4]
>> at
>> org.apache.camel.component.cxf.CxfComponent.createEndpoint(CxfComponent.java:70)[172:org.apache.camel.camel-cxf:2.10.4]
>>  at
>> org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:91)[96:org.apache.camel.camel-core:2.10.4]
>> at
>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:461)[96:org.apache.camel.camel-core:2.10.4]
>>  ... 36 more
>> Caused by: java.lang.ClassCastException: Cannot cast
>> org.apache.cxf.jaxws.EndpointImpl to
>> org.apache.camel.component.cxf.CxfEndpoint
>> at java.lang.Class.cast(Class.java:3014)[:1.7.0_21]
>>  at
>> org.apache.camel.blueprint.BlueprintContainerRegistry.lookup(BlueprintContainerRegistry.java:58)[99:org.apache.camel.camel-blueprint:2.10.4]
>>
>> Any idea how I'm supposed to structure my xml to get a CXFendpoint?
>>
>> John
>>
>>
>> On Sat, Jun 29, 2013 at 4:38 PM, John D. Ament <[email protected]>wrote:
>>
>>> So, in my scenario, this is the best I can describe it.
>>>
>>> I want to deploy a couple of web services to my servicemix instance.
>>>  These will be consumed by a legacy system that already knows how to talk
>>> to these web services.  I want to put these requests into a modified format
>>> on a JMS queue for working and return immediately back to the client (e.g.
>>> don't wait for the JMS listener to process these).
>>>
>>> On the JMS side, I expect to go through a few different transforms, one
>>> reading remote data; another converting it into a common jax-b based
>>> structure and then finally sending that JAX-B message to another system for
>>> processing.
>>>
>>> That other system will send a request over when it's done indicating
>>> that some data has to go to the first system, which I'm sure will also work
>>> fine.
>>>
>>> Ideally, I think I want my webservice to process things normally, other
>>> than having a producer that can put message data on to the queue.  Based on
>>> how it's structured, I'd prefer to not have anything in the mix in front or
>>> behind it, but could hear some arguments on why this might be best.  The
>>> service has a single method, with the signature:
>>>
>>> public boolean importData(int sourceId, int targetId, String sourceRepo,
>>> String sourceRepoGroup, int dataElementId);
>>>
>>> which simply returns true as long as the WS Is up (right now, this just
>>> dumps a message onto a JMS queue).  I can't change the argument structure,
>>> but perhaps it can go in a wrap object; not sure.
>>>
>>> After some reading, I thought my best solution would be to use a
>>> producer template, and then the wrapped version.  So I threw this into my
>>> webservice, just to see if i could get it to log messages:
>>>
>>> @EndpointInject(uri="log:events")
>>>   ProducerTemplate producer;
>>>
>>> and then in the body
>>>
>>> producer.sendBody("Received sourceRepo as "+sourceRepo);
>>>
>>> Which (I honestly wasn't surprised here) generated a null pointer
>>> exception.  So I guess I can't inject this into my webservice endpoint?
>>>
>>> Is this use case sensible?  It's probably not ideal for the ESB, but it
>>> kind of keeps things moving in the webservice with minimal changes.
>>>
>>> Thanks!
>>>
>>> John
>>>
>>
>>
>

Reply via email to