I have a plain Felix based OSGI Environment on which I have deployed a bundle, which has an Embedded ActiveMQ Broker. I want to have another bundle deployed on the same OSGI environment, which shall have an embedded jetty on which the ActiveMQ Web Console War file will be deployed. I tried by spawning the embedded jetty and deploying the war file as part of this bundle (bundleActivator Start Method), but it gives me the following exception -
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContextListener
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:431)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:393)
I have the Servlet-API jar in the bundle classpath (imported the package and is being resolved while bundle deployment). I have also noticed that the activemq-web-console-5.10.0.war file's lib folder also contain the Servlet-API jar.
So, I thought may be because of duplication of the Servlet-API jar, it it throwing this exception and removed the Servlet-API jar from my bundle classpath (removed the import, also tried by undeploying the bundle exporting that package) but in this case my bundle did not get deployed and I received wiring exceptions (as Jetty dependencies clearly need that jar).
I donot want to unpack and pack again the war file and try.
Please Note: this war file got deployed successfully on Karaf, but I am failing it to deploy on OSGI env based on plain Felix with my own felix launcher.
Please help !
EDIT
The bundle containing embedded jetty gets deployed, but when I start it, while Jetty is starting (deploying the war file) above exception is being thrown
END EDIT