I am installing an OSGi bundle to the Pax-Exam Container in a test class , Following is my code segment.
@Configuration
public Option[] config() {
return options(
mavenBundle().artifactId("sample-bundle").groupId("org.sample.code").versionAsInProject(),
I have a service registration in my bundle Activator as follows for the above sample-bundle.
bundleContext.registerService(TestCode.class.getName(), testClassInstance, null);
After debugging the test case , found that above bundle is not activated (State Number 32) and it's in resolved state (State number 4). However after I removing the above service registration from the start() method of the bundle, bundle got activated successfully.
Any idea what went wrong here?.
Maybe there is an exception in the Activator. Often these errors are not shown in the log. Use a try catch around it and lot the exception. Besides that I found that you sometimes get a better error message by grabbing and starting your bundle in the test case.