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 

 

 

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

Reply via email to