I’m having some serious trouble properly deploying Web Application Bundle (OSGi-fied WAR) on GlassFish server 3.1.2
When I deploy my WAR as just a web application, everything works fine and I can open my application in the browser.
But apart from that, I also want it to run in an OSGi environment. When I deploy my WAR as an OSGi bundle (using option --type=osgi in asadmin deploy command), the bundle is correctly installed into an OSGi container, but this time GlassFish doesn’t recognize it as a web application – I get a 404 error (The requested resource () is not available.) when trying to open my app in browser.
I found this solution, but it doesn’t work in my case.
Here’s the MANIFEST of my bundle:
Manifest-Version: 1.0
Webapp-Context: /ares-gui
Bundle-ClassPath: WEB-INF/classes
Bundle-Version: 0.0.0.unspecified
Tool: Bnd-1.50.0
Bnd-LastModified: 1332182568717
Bundle-Name: ares-gui
Bundle-ManifestVersion: 2
Created-By: 1.6.0_26 (Sun Microsystems Inc.)
Import-Package: javax.servlet;version="[3.0,4)",javax.servlet.http;ver
sion="[3.0,4)"
Bundle-SymbolicName: ares-gui
Web-ContextPath: /ares-gui
The application itself is a simple servlet annotated with a WebServlet annotation from Servlet API 3.0.
I also tried this with other example WABs found in the net (for example this one) and I get the same issue.
The solution to this problem in GlassFish 3.1.2 was to set
org.osgi.framework.startlevel.beginningoption inglassfish3/glassfish/config/osgi.propertiesconfiguration file to 3. I also setglassfish.osgi.start.level.finalto 4 because I thought it should have greater value than the first option, although I’m not sure if this was needed.