Hi Kurt,
My comment inline
On 2010-11-16, at 下午11:41, Kurt Westerfeld wrote:
Freeman, I was thinking of doing something like this, but this is
now the third separate instance related to startup that we are
fighting. It seems to me that if the system started all servicemix
(and ODE) bundles at level 60, and all other application bundles at
level 70, we would have none of these issues.
Not sure it's a good idea to specify bundle start levels, in OSGi
world, the logic shouldn't rely on the bundle start sequence.
I would also say that while I understand the technical challenge of
making our servicemix components, which are really originated from
spring-dm bundles tied back to servicemix artifacts, start in a
general sense, it really seems like our startup issues should be
something we don't have to worry about. We are in day 3 of the
fight on initialization issues, so I might be a little too close to
this. All other functionality has been great, and you have been
great in support. I just think these injection techniques should
not be necessary.
Yeah, OSGi world is a little bit different, especially when you
encounter classloader or bundle start sequence issues. OSGi bundle is
more modular and each bundle get started independently, this is the
way how OSGi works and this provide lots of benefit(there're lots of
articles/docs to explain why and how and the benefit of this
mechanism) .
And the OSGi service injection is actually the general way to ensure
that bundle start sequence dependency works.
Freeman
Thanks!
"Freeman Fang (JIRA)" <[email protected]> 11/16/2010 9:57 AM >>>
[ https://issues.apache.org/activemq/browse/SM-2011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63376
#action_63376 ]
Freeman Fang commented on SM-2011:
----------------------------------
Hi Kurt,
How about add
<osgi:reference id="nmr"
interface="org.apache.servicemix.nmr.api.NMR"
cardinality="1..1" />
into your endpoint beans.xml, this can ensure the NMR always get
started before your bundle.
Freeman
NMR Registration Fails on Startup Intermittently
------------------------------------------------
Key: SM-2011
URL: https://issues.apache.org/activemq/browse/SM-2011
Project: ServiceMix
Issue Type: Bug
Environment: Fuse 4.3
Reporter: Kurt Westerfeld
Priority: Critical
We have a number of services which start when servicemix starts,
based on servicemix-cxf-se, which publish endpoints to the NMR
implicitly by using
org.apache.servicemix.common.osgi.EndpointExporter. We are seeing
the situation where after startup, some of our services are missing
from the endpoint registry. We cannot see them using the admin
command "nmr:list", and in tracking this down, have noticed that
the org.apache.servicemix.nmr.core.EndpointRegistryImpl does not
contain a mapping for the service. This is clearly a bug, because
if we do an osgi:restart on the bundle containing our service the
NMR will correctly register the endpoints.
This is obviously causing us concern. We have worked around other
initialization problems with our servicemix-cxf-se services related
to generation of proxies by injecting the component registry
(org.apache.servicemix.jbi.runtime.ComponentRegistry) to the
proxy. We are wondering if there is a similar workaround we must
perform in order to ensure our components do not initialize before
the NMR service registry tracker is ready to receive them.
Noticing a normal initialization sees this stacktrace fragment:
org
.apache
.servicemix
.nmr
.core
.EndpointRegistryImpl
.register(org.apache.servicemix.nmr.api.Endpoint,
java.util.Map<java.lang.String,?>) line: 115
org
.apache
.servicemix
.nmr.core.EndpointRegistryImpl.register(java.lang.Object,
java.util.Map) line: 49
org
.apache
.servicemix
.nmr
.osgi
.OsgiServiceRegistryTracker
<T>.addingService(org.osgi.framework.ServiceReference) line: 78
So, it seems that the
org.apache.servicemix.nmr.osgi.OsgiServiceRegistryTracker listener
must be getting initialized *after* our own bundle in this case.
Since this class registers a service tracker, it is my bet that it
is not tracking services before our service's endpoint exporter has
started running. In another odd twist, the main culprit in our use
case exports 3 services, and only one of them seems to be missing.
The complexity of getting our services to start properly and
reliably has been the most significant issue facing us in our port
from servicemix 3 to 4. We'd appreciate some help and/or fixes to
get us moving in the right direction.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
--
Freeman Fang
------------------------
FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org