[ 
https://issues.apache.org/jira/browse/FELIX-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13124431#comment-13124431
 ] 

Richard S. Hall commented on FELIX-3153:
----------------------------------------

Ok, I hacked up ServiceMix to run with framework 4.0.0...the difficult part is 
that they provide their own OSGi API classes instead of using the ones coming 
from the framework...this is probably not a smart thing since frameworks are 
free to make implementation-specific adaptations to the OSGi API 
implementations, so you cannot be sure that a given framework will work 
properly with the original OSGi JARs. At any rate...

I was able to reproduce similar issues. In the end, I believe I understand at 
least some aspect of what is going wrong. When refreshing bundles, the Felix 
framework is stopping and refreshing bundles one at a time, when in fact it 
should be stopping them all first, then refreshing them all in a separate pass, 
and finally restarting them again in a third pass. So, I will commit a patch to 
do just that and change the subject of this bug to more accurately reflect the 
issue.

Unfortunately, it doesn't appear to make the refresh of the spring context 
bundle work correctly, but at least the error is more consistent and 
controlled. I regularly see this:

ERROR: Bundle org.apache.servicemix.jbi.osgi [123] EventDispatcher: Error 
during dispatch. (org.apache.servicemix.nmr.api.ServiceMixException: Unable to 
register service servicemix-wsn2005 with properties {NAME=servicemix-wsn2005, 
objectClass=[Ljava.lang.String;@2cf9f1b5, service.id=725, TYPE=service-engine}. 
Reason: javax.jbi.JBIException: Error calling init)
org.apache.servicemix.nmr.api.ServiceMixException: Unable to register service 
servicemix-wsn2005 with properties {NAME=servicemix-wsn2005, 
objectClass=[Ljava.lang.String;@2cf9f1b5, service.id=725, TYPE=service-engine}. 
Reason: javax.jbi.JBIException: Error calling init
        at 
org.apache.servicemix.nmr.core.ServiceRegistryImpl.register(ServiceRegistryImpl.java:52)
        at 
org.apache.servicemix.nmr.osgi.OsgiServiceRegistryTracker.addingService(OsgiServiceRegistryTracker.java:78)
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:980)
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:906)
        at 
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:262)
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:234)
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:941)
        at 
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
        at 
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
        at 
org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4250)
        at org.apache.felix.framework.Felix.registerService(Felix.java:3275)
        at 
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
        at 
org.apache.servicemix.jbi.deployer.impl.Deployer.registerService(Deployer.java:762)
        at 
org.apache.servicemix.jbi.deployer.impl.Deployer.registerComponent(Deployer.java:418)
        at 
org.apache.servicemix.jbi.deployer.impl.ComponentInstaller.initComponent(ComponentInstaller.java:424)
        at 
org.apache.servicemix.jbi.deployer.impl.ComponentInstaller.install(ComponentInstaller.java:150)
        at 
org.apache.servicemix.jbi.deployer.impl.Deployer.registerDeployedComponent(Deployer.java:657)
        at 
org.apache.servicemix.jbi.deployer.impl.Deployer$1.addingService(Deployer.java:222)
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:980)
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:906)
        at 
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:262)
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:234)
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:941)
        at 
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
        at 
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
        at 
org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4250)
        at org.apache.felix.framework.Felix.registerService(Felix.java:3275)
        at 
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.registerService(BlueprintContainerImpl.java:388)
        at 
org.apache.aries.blueprint.container.ServiceRecipe.register(ServiceRecipe.java:166)
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.registerServices(BlueprintContainerImpl.java:646)
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:314)
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:213)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:680)
Caused by: javax.jbi.JBIException: Error calling init
        at 
org.apache.servicemix.common.AsyncBaseLifeCycle.init(AsyncBaseLifeCycle.java:213)
        at 
org.apache.servicemix.jbi.deployer.artifacts.ComponentImpl$ComponentWrapper.init(ComponentImpl.java:247)
        at 
org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl.doRegister(ComponentRegistryImpl.java:89)
        at 
org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl.doRegister(ComponentRegistryImpl.java:38)
        at 
org.apache.servicemix.nmr.core.ServiceRegistryImpl.register(ServiceRegistryImpl.java:47)
        ... 42 more
Caused by: javax.jms.JMSException: Could not connect to broker URL: 
tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused
        at 
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
        at 
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:286)
        at 
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:230)
        at 
org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:178)
        at 
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:137)
        at 
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:121)
        at 
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:92)
        at 
$javax.jms.ConnectionFactory$$EnhancerByCGLIB$$786945a.createConnection(<generated>)
        at 
org.apache.servicemix.wsn.jms.JmsNotificationBroker.init(JmsNotificationBroker.java:48)
        at 
org.apache.servicemix.wsn.component.WSNComponent.doInit(WSNComponent.java:147)
        at 
org.apache.servicemix.common.AsyncBaseLifeCycle.init(AsyncBaseLifeCycle.java:205)
        ... 46 more
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
        at java.net.Socket.connect(Socket.java:529)
        at 
org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:484)
        at 
org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:447)
        at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:53)
        at 
org.apache.activemq.transport.InactivityMonitor.start(InactivityMonitor.java:127)
        at 
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58)
        at 
org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72)
        at 
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58)
        at 
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58)
        at 
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:266)
        ... 55 more
                
> refreshPackages on certain bundles can create a mess
> ----------------------------------------------------
>
>                 Key: FELIX-3153
>                 URL: https://issues.apache.org/jira/browse/FELIX-3153
>             Project: Felix
>          Issue Type: Bug
>    Affects Versions: framework-3.0.9, framework-3.2.2
>            Reporter: Ioannis Canellos
>             Fix For: framework-4.0.1
>
>
> When using refreshPackages on a bundle that is used by a lot of other 
> bundles, it results in error.
> There is no deterministic behavior and the error is not always the same, even 
> if I repeat the exact same test twice.
> A typical example on how I reproduce it is to refresh the spring-context 
> bundle inside servicemix 4.4 (running on felix).
> If I switch to equinox I don't have that issue. That doesn't say much, but I 
> mention it to exclude other possibilities. 
> From my logs I see that Felix tries to refresh the bundles in the populated 
> graph with a different order each time (I don't know if this helps 
> identifying the issue).
> Usually, the error looks like this:
> ERROR: Bundle org.springframework.osgi.extender [83] Error stopping bundle. 
> (java.lang.NoClassDefFoundError: org/osgi/framework/ServiceRegistration)
> java.lang.NoClassDefFoundError: org/osgi/framework/ServiceRegistration
>       at 
> org.springframework.osgi.util.OsgiServiceUtils.unregisterService(OsgiServiceUtils.java:41)
>       at 
> org.springframework.osgi.extender.internal.support.NamespaceManager.unregisterResolverService(NamespaceManager.java:195)
>       at 
> org.springframework.osgi.extender.internal.support.NamespaceManager.destroy(NamespaceManager.java:223)
>       at 
> org.springframework.osgi.extender.internal.activator.ContextLoaderListener.shutdown(ContextLoaderListener.java:547)
>       at 
> org.springframework.osgi.extender.internal.activator.ContextLoaderListener.stop(ContextLoaderListener.java:431)
>       at 
> org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:651)
>       at org.apache.felix.framework.Felix.stopBundle(Felix.java:2216)
>       at org.apache.felix.framework.Felix$RefreshHelper.stop(Felix.java:4489)
>       at org.apache.felix.framework.Felix.refreshPackages(Felix.java:3581)
>       at 
> org.apache.felix.framework.PackageAdminImpl.run(PackageAdminImpl.java:363)
>       at java.lang.Thread.run(Thread.java:680)
> Caused by: java.lang.ClassNotFoundException: 
> org.osgi.framework.ServiceRegistration not found by 
> org.springframework.osgi.core [80]
>       at 
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)
>       at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
>       at 
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>       ... 11 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to