Fragment bundles are not able to be started, this is usually just a
warning which might be ignored.
Fragment bundles only get resolved and should be attached to the host bundle.

Regards, Achim

2011/8/22 Sathyakumar Seshachalam <[email protected]>:
> My bad - It was a manifest entry problem. Thanks for the help.
>
> Regards
> Sathya
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Sathyakumar
> Seshachalam
> Sent: Monday, August 22, 2011 11:42 AM
> To: General OPS4J
> Subject: RE: pax exam JUnit4TestRunner annotated test class accessing
> anOSGiservice
>
> Hi Harald,
>
> My OsgiUtils infact is using service tracker to get a service reference
> and it does block for the service to become available. I am not able to
> use a native container right now for my tests, because my list of
> bundles contain some fragment bundles which cause problem in native
> container (saying fragment bundles cannot be started - not sure if this
> is a bug).
>
> Can you shed some more light on this
> "I think the best way to find out what's going wrong is to enable an
> OSGi console by adding a system property and/or additional bundles,
> depending on your framework and then to inspect the bundle states from
> the console when your Pax Exam test is running."
>
> Am actually using equinox, and instead of a console what I've done is
> from within my test method, have printed all bundle's state gotten from
> the bundle context and ensured my bundle's state is actually ACTIVE.
>
>
> Regards
> Sathya
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Harald Wellmann
> Sent: Friday, August 19, 2011 6:13 PM
> To: General OPS4J
> Subject: Re: pax exam JUnit4TestRunner annotated test class accessing an
> OSGiservice
>
> Hi Sathya,
>
> Pax Exam 2.2.0 does not provide service injection or any special APIs
> for acquiring a service. You just have to use the standard OSGi
> facilities, e.g. ServiceTracker. (This will improve in 2.3.0.)
>
> I don't know this OsgiUtils class you're using. If it does not block
> waiting for the service to become available, then your test is not safe.
>
> Services may be registered later than you expect, even when the service
> is provided by a bundle with a lower start level.
>
> A ClassNotFoundException may be caused by a bundle not resolving
> properly.
>
> Using Pax Runner separately to check that the bundles in your system
> under test is fine, but Pax Exam provisions some additional bundles that
> might cause conflicts.
>
> I think the best way to find out what's going wrong is to enable an OSGi
> console by adding a system property and/or additional bundles, depending
> on your framework and then to inspect the bundle states from the console
> when your Pax Exam test is running.
>
> Using the Native Container instead of Pax Runner might also help to
> analyze the problem, and after that you could switch back to Pax Runner
> if you prefer.
>
> Best regards,
> Harald
>
>
> -------- Original-Nachricht --------
>> Datum: Fri, 19 Aug 2011 15:22:40 +0530
>> Von: "Sathyakumar Seshachalam" <[email protected]>
>> An: [email protected]
>> Betreff: pax exam JUnit4TestRunner annotated test class accessing an
> OSGi    service
>
>> Hi,
>>
>> I wrote a simple test case (and my first one) that uses
>> @Junit4TestRunner, My test method basically goes something like
>>
>>
>>
>> ...
>>
>> @Test
>>
>> public void  invokeService(BundleContext bundleContext) {
>>
>> AService aServiceInt = OsgiUtils.getService(bundleContext,
>> AService.class);
>>
>>
>>
>> ...
>>
>>
>>
>> Basically I have these issues
>>
>> 1.       When I added a vmOption to remote debug my test case (I use
> pax
>> runner), I more often than not get a
>>
>> java.lang.RuntimeException: Cannot get the remote bundle context
>>
>>                 at
>>
> org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.getRe
>> moteBundleContext(RemoteBundleContextClientImpl.java:275)
>>
>>                 at
>>
> org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.waitF
>> orState(RemoteBundleContextClientImpl.java:234)
>>
>>                 at
>>
> org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer.waitFor
>> State(PaxRunnerTestContainer.java:207)
>>
>> ......
>>
>> 2.       When I remove it,
>>
>>    org.ops4j.pax.exam.TestContainerException:
>> java.lang.reflect.InvocationTargetException
>>
>>                 at
>>
> org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.injectContextAnd
>> Invoke(ProbeInvokerImpl.java:118)
>>
>>                 at
>>
> org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.findAndInvoke(Pr
>> obeInvokerImpl.java:71)
>>
>>                 at
>>
> org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.call(ProbeInvoke
>> rImpl.java:58)
>>
>> .......
>>
>> Caused by: java.lang.NoClassDefFoundError: com.myorg.AService
>>
>> ......
>>
>> Caused by: java.lang.ClassNotFoundException: com.myorg.AService
>>
>>                 at
>>
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLo
>> ader.java:506)
>>
>>                 at
>>
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.jav
>> a:422)
>>
>>
>>
>> Note that my actual bundle's start level is 4 (the one that exposes
>> AService), and so is the errors because the "on the fly test bundle"
>> starts at a much lower level ? How do I change or rather how do I make
>> mandatory imports of my service interfaces in the "on the fly bundle".
>>
>>
>>
>> Also Note that I have used pax runner separately and ensured that
>> bundles are correct and indeed expose services properly.
>>
>>
>>
>> Regards
>>
>> Sathya
>>
>>
>>
>>
>>
>
> --
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>



-- 
--
*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/>

_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to