I’ve tried changing the order of the registries - use the Blueprint registry before the OSGi Registry, but that doesn’t change anything.
I’ve also checked the call stack when the service is invoked - it’s the same in each case: java.lang.Exception at com.pronoia.osgi.service.impl.ServiceOneImplementation.execute(ServiceOneImplementation.java:16) at Proxy27ba56af_6676_4862_9b51_66812e5ba792.execute(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_73] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_73] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_73] at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_73] at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:177)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:68)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:38)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:192)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76)[58:org.apache.camel.camel-core:2.17.0.SNAPSHOT] at java.util.TimerThread.mainLoop(Timer.java:555)[:1.8.0_73] at java.util.TimerThread.run(Timer.java:505)[:1.8.0_73] However, there is a significant difference in the logs (set to TRACE for org.apache.camel.blueprint, org.apache.camel.core.osgi, org.apache.camel.component.bean, org.apache.camel.util and org.apache.camel.impl) during initialization. The org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader loads far more classes in the broken scenario. Interestingly though, the org.apache.aries.util.tracker.hook.BundleHookTracker$Tracked class isn’t loaded in the broken case, and it in the working case. Still digging - any advice would be GREATLY appreciated. > On Mar 2, 2016, at 1:57 PM, Quinn Stevenson <[email protected]> > wrote: > > I’ve been trying to figure out what’s going on with this issue ( > https://issues.apache.org/jira/browse/CAMEL-9570 > <https://issues.apache.org/jira/browse/CAMEL-9570> ) for quite a while now, > and I’m not getting anywhere - I could really use some guidance. > > I have a very simple route builder > > public class ServiceConsumerBuilder extends RouteBuilder{ > Logger log = LoggerFactory.getLogger(this.getClass()); > > String beanId = "osgi-service"; > String timerName = "default-timer"; > > Object beanInstance; > > public ServiceConsumerBuilder() { > } > > @Override > public void configure() throws Exception { > fromF( "timer://%s?period=%d&fixedRate=%b > <timer://%s?period=%d&fixedRate=%b>", timerName, 5000, true) > .routeId( "java-route") > .setBody().constant( "Dummy Value") > // .bean( beanInstance, "execute", false) > .toF( "bean://%s?cache=%b&method=%s > <bean://%s?cache=%b&method=%s>", beanId, false, "execute") > .to( "mock://result <mock://result>") > ; > > } > > public String getTimerName() { > return timerName; > } > > public void setTimerName(String timerName) { > this.timerName = timerName; > } > > public String getBeanId() { > return beanId; > } > > public void setBeanId(String beanId) { > this.beanId = beanId; > } > > public Object getBeanInstance() { > return beanInstance; > } > > public void setBeanInstance(Object beanInstance) { > Exception ex = new Exception(); > ex.fillInStackTrace(); > log.info( "Setting beanInstance", ex ); > > this.beanInstance = beanInstance; > } > > public static void main( String[] args ) { > System.out.println( "Hello"); > > } > } > > And when I used the following blueprint, everything works great - dynamic > service changes are picked up. > > <?xml version="1.0" encoding="UTF-8"?> > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0 > <http://www.osgi.org/xmlns/blueprint/v1.0.0>" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance > <http://www.w3.org/2001/XMLSchema-instance>" > > xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 > <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0>" > xmlns:camel="http://camel.apache.org/schema/blueprint > <http://camel.apache.org/schema/blueprint>" > xsi:schemaLocation=" > http://www.osgi.org/xmlns/blueprint/v1.0.0 > <http://www.osgi.org/xmlns/blueprint/v1.0.0> > http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd > <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd> > http://camel.apache.org/schema/blueprint > <http://camel.apache.org/schema/blueprint> > http://camel.apache.org/schema/blueprint/camel-blueprint.xsd > <http://camel.apache.org/schema/blueprint/camel-blueprint.xsd>"> > > <cm:property-placeholder persistent-id="blueprint-test" > update-strategy="reload" > > <cm:default-properties> > <cm:property name="timer-name" value="blueprint-consumer" /> > </cm:default-properties> > </cm:property-placeholder> > > <reference id="osgi-service" > interface="com.pronoia.osgi.service.MyServiceInterface" > filter="implementation=bp-external"/> > > <bean id="java-route" > class="com.pronoia.camel.builder.ServiceConsumerBuilder" > > <property name="beanId" value="osgi-service" /> > <property name="timerName" value="java-${timer-name}" /> > </bean> > > <camelContext id="blueprint-context" > xmlns="http://camel.apache.org/schema/blueprint > <http://camel.apache.org/schema/blueprint>"> > <routeBuilder ref="java-route" /> > </camelContext> > > </blueprint> > However, as soon as change the blueprint to the following (I just inject the > service reference into the route builder - but it’s never used/called), I no > longer get dynamic updates. > > <?xml version="1.0" encoding="UTF-8"?> > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0 > <http://www.osgi.org/xmlns/blueprint/v1.0.0>" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance > <http://www.w3.org/2001/XMLSchema-instance>" > > xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 > <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0>" > xmlns:camel="http://camel.apache.org/schema/blueprint > <http://camel.apache.org/schema/blueprint>" > xsi:schemaLocation=" > http://www.osgi.org/xmlns/blueprint/v1.0.0 > <http://www.osgi.org/xmlns/blueprint/v1.0.0> > http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd > <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd> > http://camel.apache.org/schema/blueprint > <http://camel.apache.org/schema/blueprint> > http://camel.apache.org/schema/blueprint/camel-blueprint.xsd > <http://camel.apache.org/schema/blueprint/camel-blueprint.xsd>"> > > <cm:property-placeholder persistent-id="blueprint-test" > update-strategy="reload" > > <cm:default-properties> > <cm:property name="timer-name" value="blueprint-consumer" /> > </cm:default-properties> > </cm:property-placeholder> > > <reference id="osgi-service" > interface="com.pronoia.osgi.service.MyServiceInterface" > filter="implementation=bp-external"/> > > <bean id="java-route" > class="com.pronoia.camel.builder.ServiceConsumerBuilder" > > <property name="beanId" value="osgi-service" /> > <property name="beanInstance" ref="osgi-service" /> > <property name="timerName" value="java-${timer-name}" /> > </bean> > > <camelContext id="blueprint-context" > xmlns="http://camel.apache.org/schema/blueprint > <http://camel.apache.org/schema/blueprint>"> > <routeBuilder ref="java-route" /> > </camelContext> > > </blueprint> > I’ve been running this in a debugger and trying to figure out what’s going > on, but I’m stuck. Any help/suggestions would be GREATLY appreciated. > >
