I am new to OSGi. I am using eclipse PDE 'Kepler Service Release 2'.
I want to make classes inside the javax.servlet package available for my test clients. But I am getting NoClassDefFoundError when , just for testing, trying to create a ServletException object.
java.lang.NoClassDefFoundError: javax/servlet/ServletException.
I have tried these two ways. both are not working:
Try 1: using system packages
I have these startup parameters in my eclipse OSGI Framework:
-Dorg.osgi.framework.system.packages.extra=javax.servlet
-Dorg.osgi.framework.system.capabilities="osgi.ee; osgi.ee=\"JavaSE \";version:List=\"1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8\""
I can see this Export-Package in the System Bundle (0) : javax.servlet; version="0.0.0"[exported]
Im my bundle I have this Import-Package: org.osgi.framework;version="[1.5,2)",javax.servlet
.
I could not get this working even with a flag -Dorg.osgi.framework.bootdelegation=*
while starting the container.
Try 2: using the ExtensionBundle
My ExtensionBundle has the jar javaee-api-6.0.jar in its classpath and exports the javax.servlet package. But still I am getting 'java.lang.NoClassDefFoundError: javax/servlet/ServletException'.
I dont have any startup parameters for this.
In the Manifest.mf of the extension bundle: ...
Bundle-ClassPath: .,javaee-api-6.0.jar
Export-Package: ....,javax.servlet,...
Fragment-Host: system.bundle;extension:=framework
...
Am I missing anything.
Thanks in advance.