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
在构建路径中添加servlet-api.jar并尝试。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.