简体   繁体   English

OSGI Web Bundle的奇怪问题,现在完全消失了

[英]Strange issues with OSGI web bundle,completely lost right now

I've been learning OSGI recently, and I'm having this problem when using STS 3.1 + virgo tomcat server 3.6 to build a web bundle , the task is simple, just need to deploy my bundle and display a jsp page, there are some good tutorials out there, but they basically all use spring to do this, I had some difficulties configuring spring MVC for OSGI, the jsp file I tried to access kept giving me 404 error,so I decide to rebuild things from scratch and hopefully find the reason for the failed experiment,first thing to do should be displaying a jsp page without spring, but if I simply import some javaweb-related packages ,set the Web-ContextPath , put a jsp file under web-info folder,the 404 error is still there , and I don't know what else to do, could someone tell me what might have caused it? 我最近一直在学习OSGI,在使用STS 3.1 + virgo tomcat服务器3.6来构建Web包时遇到了这个问题,任务很简单,只需要部署我的包并显示一个jsp页面,有一些好的教程,但基本上它们都使用spring来完成,我在为OSGI配置spring MVC时遇到了一些困难,我尝试访问的jsp文件一直给我404错误,所以我决定从头开始重建并希望找到实验失败的原因,第一件事应该是显示没有spring的jsp页面,但是如果我简单地导入一些与javaweb相关的包,设置Web-ContextPath,将一个jsp文件放在web-info文件夹下,则404错误是还在那儿,我不知道该怎么办,有人可以告诉我是什么原因造成的吗? shouldn't a OSGI web bundle be able to access a web page directly instead of importing a bunch of special packages? OSGI Web捆绑包不应该能够直接访问网页而不是导入一堆特殊软件包吗?

I've appended this script into my web.xml like one of those examples shows(can someone tell me what does it do?) 我已将这些脚本添加到了web.xml中,就像其中一个示例示例所示(有人可以告诉我它是做什么的吗?)

    <context-param>
    <param-name>contextClass</param-name>
    <param-value>org.eclipse.virgo.web.dm.
    ServerOsgiBundleXmlWebApplicationContext
    </param-value>
    </context-param>

and My manifest.MF looks something like this: 和我的manifest.MF看起来像这样:

Manifest-Version: 1.0
Bundle-ClassPath: WEB-INF/classes
Web-ContextPath: /osgitest
Import-Package: 
javax.servlet;version="[3.0.0,3.0.0]",
javax.servlet.http;version="[3.0.0,3.0.0]",
javax.servlet.jsp;version="[2.2.0,2.2.0]",
javax.servlet.jsp.el;version="[2.2.0,2.2.0]",
javax.servlet.jsp.jstl.core;version="[1.2.0.v20110728,1.2.0.v20110728]",
org.eclipse.virgo.web.dm;version="[3.6.0.RELEASE,3.6.0.RELEASE]",
org.slf4j;version="[1.7.2,1.7.2]"
Bundle-SymbolicName: c2c.osgitest.web
Bundle-Version: 1.0.0

and i'm using 我正在使用

http://localhost:8080/osgitest/login.jsp

Any suggestion would be appreciated! 任何建议,将不胜感激!

so I decided to rebuild things from scratch and hopefully find the reason for the failed experiment. 因此,我决定从头开始重建工作,并希望找到导致实验失败的原因。 The first thing to do should be displaying a JSP page without Spring. 首先要做的是显示没有Spring的JSP页面。

If Spring is a mere option (and other solutions are acceptable), I'd recommend to use Eclipse IDE, WebSphere Developer Tools and WebSphere Liberty Profile . 如果仅使用Spring(并且可以接受其他解决方案),那么我建议使用Eclipse IDE, WebSphere Developer ToolsWebSphere Liberty Profile

In Eclipse IDE, create OSGi Bundle Project with Web 3.0 support and then add a JSP page. 在Eclipse IDE中,创建具有Web 3.0支持的OSGi Bundle Project ,然后添加一个JSP页面。 When you run it, it's supposed to work. 当您运行它时,它应该可以工作。 You may want to compare the bundle's configuration (mostly META-INF/MANIFEST.MF) with yours (and then decide to leverage Spring perhaps). 您可能想将包的配置(主要是META-INF / MANIFEST.MF)与您的配置进行比较(然后决定利用Spring)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM