I am trying to use OSGi and maven to develop an standard alone application.
I have the following osgi dependency in pom.xml
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
</dependency>
I tried the following code
import org.osgi.framework.launch.FrameworkFactory;
FrameworkFactory frameworkFactory = ServiceLoader.load(FrameworkFactory.class).iterator().next();
and got this error message
Exception in thread "main" java.util.ServiceConfigurationError: org.osgi.framework.launch.FrameworkFactory: Provider org.osgi.framework.launch.FrameworkFactory could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at com.scottfu.ci.test.OSGiTest.main(OSGiTest.java:19)
Caused by: java.lang.InstantiationException: org.osgi.framework.launch.FrameworkFactory
at java.lang.Class.newInstance(Class.java:427)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 3 more
Caused by: java.lang.NoSuchMethodException: org.osgi.framework.launch.FrameworkFactory.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
... 4 more
what is wrong?