【问题标题】:convert .WAR for auto deploy in karaf/servicemix转换 .WAR 以在 karaf/servicemix 中自动部署
【发布时间】:2012-08-23 14:27:39
【问题描述】:

我有一个非常简单的包含示例 servlet 的 .WAR。我可以使用以下命令在 servicemix 中部署它:

osgi:install file:///home/seiho/apache-servicemix-4.4.2/deploy/TestServlet.war?Bundle-SymbolicName=TestServlet&Webapp-Context=/TestServlet

然后在我的浏览器中查看。但只有文件的完整路径,例如:localhost:8080/TestServlet/index.html 或 localhost:8080/TestServlet/TestServlet(我的 servlet 是 TestServlet 类)。
我想输入后自动启动index.html页面:localhost:8080/TestServlet

怎么做?



更重要
我需要一种方法来转换 .WAR 文件或 servlet 项目(我有源代码),以便可以通过将新的 .WAR 文件复制到 $SERVICEMIX_HOME/deploy 目录来自动部署它。

我尝试编辑 MANIFEST.MF 文件,但没有成功。可能我做错了什么。

感谢您的任何建议/帮助。

【问题讨论】:

  • 你的新清单是什么样的?
  • Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.3 Created-By: 1.7.0_06-b24 (Oracle Corporation) Bundle-ManifestVersion: 2 Bundle-SymbolicName: TestServlet Bundle-ClassPath: . , WEB-INF/classes Import-Package: javax.servlet, javax.servlet.http
  • n900crack.yoyo.pl/images/TestServlet.war - 是我拥有的 .WAR 文件的链接。

标签: servlets osgi war apache-servicemix hotdeploy


【解决方案1】:

要被识别为 wab,您需要在清单中添加上下文路径标头:

Web-ContextPath: TestServlet

【讨论】:

  • 是的,我做到了。但它仍然无法自动部署。添加捆绑版本修复了自动部署问题。接下来,我添加 Web-ContextPath:TestServlet 条目,就像您编写的那样。谢谢
【解决方案2】:

它现在正在工作!我正在根据这个页面做我的 MANIFEST.MF:http://team.ops4j.org/wiki/display/ops4j/Pax+Web+Extender+-+War+-+OSGi-fy

问题在于,出于某种原因,“Bundle-Version: 1.0”行是必需的,而不是该页面上所述的可选行。

老实说,只需添加 Bundle-Version 修复即可。

我知道 MANIFEST.MF 有问题,在 Holly Cummins 提出问题后,我又使用了它。谢谢霍莉。

我仍然无法手动启动网站(必须手动输入 index.html)。

http://localhost:8080/TestServlet/ 给了我这个:


HTTP 错误 404

访问 /TestServlet/ 时出现问题。原因:

Not Found

由 Jetty 提供支持://


http://localhost:8080/TestServlet/index.html 给了我合适的网站。

【讨论】:

    猜你喜欢
    • 2015-06-14
    • 2012-08-19
    • 1970-01-01
    • 2014-08-29
    • 2016-06-08
    • 2013-04-08
    • 2011-10-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多