Hi Achim,

Many thanks for the clarification. As I have tested all the
possibilities, I will not use a fragment but add an optional import in
Apache ServiceMix Antlr bundle as that was the goal of this fragment !

Regards,

Charles Moulliard

Apache Committer

Blog : http://cmoulliard.blogspot.com
Twitter : http://twitter.com/cmoulliard
Linkedin : http://www.linkedin.com/in/charlesmoulliard
Skype: cmoulliard



On Thu, Aug 11, 2011 at 5:33 PM, Achim Nierbeck <[email protected]> wrote:
> Hi Charles,
>
> this depends on the resolver, if the fragment bundle is "started" or
> resolved before the host bundle it is
> being attached because the resolver already knows that there is a
> fragment bundle available. (Especially with felix AFAIR)
> If your host bundle is already started your fragment won't get
> attached to it since it is to late.
>
> If you're using features.xml you need to place your fragment bundle
> before the host bundle,
> if you're droping those bundle in the deploy folder you need to make
> sure the fragment bundle is dropped in that folder
> before your host bundle.
> if you use the startup properies make sure your fragment bundle is
> also "started" earlier than the host bundle.
>
> There has also been a discussion around this issue at the felix list:
>
> http://old.nabble.com/Moving-fragment-to-Resolved-state-in-fileinstall-watched-directory--tp32052770p32089187.html
>
> regards, Achim
>
> 2011/8/11 Charles Moulliard <[email protected]>:
>> Hi,
>>
>> In some random case, a fragment bundle is not attached to its host. No
>> error is reported on the console or in the log. If I do a "refresh
>> Host_bundle_id fragment_bundle_id", then I can attach the fragment.
>>
>> Does anybody knows the reason of this issue and How to solve it ?
>>
>> [ 200] [Installed  ] [            ] [       ] [   60]
>> servicemix-antlr-hibernate-hql (1.0.0) // fragment bundle not attached
>> to 238 = Antlr
>> [ 205] [Active     ] [            ] [       ] [   60] Technical Objects 
>> (1.1.1)
>> [ 207] [Active     ] [            ] [       ] [   60] middleware-utils 
>> (1.1.2)
>> [ 219] [Active     ] [            ] [       ] [   60] Business Objects 
>> (1.4.0)
>> [ 220] [Active     ] [            ] [       ] [   60] Services
>> Signatures (1.3.0)
>> [ 222] [Installed  ] [            ] [       ] [   60] Service CAN Data 
>> (1.0.0)
>> [ 223] [Installed  ] [            ] [       ] [   60] Service Fleet
>> Management (1.3.0)
>> [ 224] [Installed  ] [            ] [       ] [   60] Process Store
>> CAN Event (1.0.0)
>> [ 227] [Installed  ] [            ] [       ] [   60] batch conversion
>> of legacy customers (1.2.0)
>> [ 228] [Installed  ] [            ] [       ] [   60] batch conversion
>> of legacy vehicles (1.2.0)
>> [ 238] [Active     ] [            ] [       ] [   60] Apache
>> ServiceMix Bundles: antlr-2.7.7 (2.7.7.2)
>>
>> Moreover sometimes when executing the command :
>>
>> karaf@root> refresh 238 200
>>
>> I getr the error :
>> karaf@root> ERROR: Bundle org.springframework.osgi.extender [62] 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:2210)
>>        at 
>> org.apache.felix.framework.Felix$RefreshHelper.stop(Felix.java:4554)
>>        at org.apache.felix.framework.Felix.refreshPackages(Felix.java:3571)
>>        at 
>> org.apache.felix.framework.PackageAdminImpl.run(PackageAdminImpl.java:365)
>>        at java.lang.Thread.run(Thread.java:636)
>> Caused by: java.lang.ClassNotFoundException:
>> org.osgi.framework.ServiceRegistration not found by
>> org.springframework.osgi.core [59]
>>        at 
>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)
>>        at 
>> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
>>        at 
>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1806)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>>        ... 11 more
>>
>> Regards,
>>
>> Charles Moulliard
>>
>> Apache Committer
>>
>> Blog : http://cmoulliard.blogspot.com
>> Twitter : http://twitter.com/cmoulliard
>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>> Skype: cmoulliard
>>
>
>
>
> --
> --
> *Achim Nierbeck*
>
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> Committer & Project Lead
> blog <http://notizblog.nierbeck.de/>
>

Reply via email to