user3488102
user3488102

Reputation:

OSGI bundle for GF4 javax.servlet.http.HttpServlet - ClassNotFound

This is my first attempt to make an osgi bundle with servlet inside. Having googled I made this budnle and it was successfully started by glassfish 4. But when in browser I try to open it I get

java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet not found by ... [299] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)

My manifest file:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: tutu
Bundle-Version: 1.0.0
Bundle-ClassPath: WEB-INF/classes
Web-ContextPath: /tutu
Import-Package: javax.servlet,javax.servlet.annotation, javax.servlet.http

As far as I understand osgi doesn't import these packages although I can be wrong. Please, help to fix this problem.

EDIT: I found the mistake. Order in MANIFEST makes sense. So the final manifest:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: tutu
Bundle-Name: tutut
Bundle-Version: 1.0.0
Import-Package: javax.servlet,javax.servlet.annotation, javax.servlet.http
Bundle-ClassPath: WEB-INF/classes
Web-ContextPath: /tutu

Upvotes: 1

Views: 613

Answers (1)

viswanadh
viswanadh

Reputation: 33

ADD servlet-api.jar in build path and try.

Upvotes: 0

Related Questions