首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android平台Knopflerfish上的Pax Web

Android平台Knopflerfish上的Pax Web
EN

Stack Overflow用户
提问于 2013-11-04 03:25:54
回答 1查看 470关注 0票数 1

我计划使用wherein在Android上启动OSGi,这样我就能够在Android上运行Java (jsp)和Java。

我的第一步是在安卓系统上安装Knopflerfish。我遵循了下面的教程:tutorial.html

Knopflerfish做得很好,我在Android手机浏览器上看到了本地主机:8080。

我的第二步是在Knopflerfish上安装Pax Web,这也安装在Android上。我还从这里学习了他们的教程:tutorial.html

该教程说:

卸载KF包 第一步是停止HTTP包并卸载JSDK和HTTP包,因为PaxWeb将接管这个函数。通常,您也很可能希望卸载HTTP包,但是对于本教程,我们将继续安装它。确保在进入下一步之前执行刷新包。

然后:

安装PaxWeb 第二步是从PaxWeb安装并启动以下包。

  • pax-web-jsp-1.0.2.jar (安装)
  • pax-web-jetty-bundle-1.0.2.jar (安装和启动)
  • pax-web-扩展程序-war-0.8.0.jar(安装和启动)

成功安装了Pax Web包。

问题

无法启动Pax Web包。

当我尝试启动HTTP-root-IMP时,它会在控制台上给出这个错误消息,这是一个Knopflerfish包。

代码语言:javascript
复制
[stderr] ## DEBUG: errors - FrameworkErrorEvent bundle #20
[stderr] ## DEBUG: errors - FrameworkErrorEvent throwable:
Couldn't start bundle: HTTP-root-IMPL (#20) (due to: org.osgi.framework.BundleException: Bundle#20, unable to resolve: Missing package(s) or can not resolve all of the them:
org.osgi.service.http;version=[1.1.0,2.0.0) -- Could not resolve exporting bundle - org.osgi.service.http;version=1.2.0 Bundle[id=16,gen=0].
javax.servlet.http;version=[2.5.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet.http;version=2.5.0 Bundle[id=16,gen=0].
javax.servlet;version=[2.5.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet;version=2.5.0 Bundle[id=16,gen=0].)
org.osgi.framework.BundleException: Bundle#20, unable to resolve: Missing package(s) or can not resolve all of the them:
org.osgi.service.http;version=[1.1.0,2.0.0) -- Could not resolve exporting bundle - org.osgi.service.http;version=1.2.0 Bundle[id=16,gen=0].
javax.servlet.http;version=[2.5.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet.http;version=2.5.0 Bundle[id=16,gen=0].
javax.servlet;version=[2.5.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet;version=2.5.0 Bundle[id=16,gen=0].
        at org.knopflerfish.framework.BundleImpl.getUpdatedState(BundleImpl.java:1259)
        at org.knopflerfish.framework.BundleImpl.finalizeActivation(BundleImpl.java:312)
        at org.knopflerfish.framework.PermissionOps.callFinalizeActivation(PermissionOps.java:265)
        at org.knopflerfish.framework.BundleImpl.start(BundleImpl.java:295)
        at org.knopflerfish.bundle.frameworkcommands.FrameworkCommandGroup.cmdStart(FrameworkCommandGroup.java:1634)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at org.knopflerfish.service.console.CommandGroupAdapter.execute(CommandGroupAdapter.java:256)
        at org.knopflerfish.bundle.console.Command$2.run(Command.java:239)
        at java.security.AccessController.doPrivileged(AccessController.java:45)
        at org.knopflerfish.bundle.console.Command.run(Command.java:226)
        at java.lang.Thread.run(Thread.java:856)

另一个问题是,我将从Knopflerfish的Pax Web教程中开始捆绑包。在这里,我试图启动pax-web-jetty-bundle-1.0.2.jar (OPS4J Pax Web - Jetty Bundle)

代码语言:javascript
复制
[stderr] ## DEBUG: errors - FrameworkErrorEvent bundle #16
[stderr] ## DEBUG: errors - FrameworkErrorEvent throwable:
Couldn't start bundle: OPS4J Pax Web - Jetty Bundle (#16) (due to: org.osgi.framework.BundleException: Bundle#16, unable to resolve: Missing package(s) or can not resolve all of the them:
javax.security.sasl -- No providers found.
javax.management.remote -- No providers found.
javax.management.modelmbean -- No providers found.
javax.management -- No providers found.)
org.osgi.framework.BundleException: Bundle#16, unable to resolve: Missing package(s) or can not resolve all of the them:
javax.security.sasl -- No providers found.
javax.management.remote -- No providers found.
javax.management.modelmbean -- No providers found.
javax.management -- No providers found.
        at org.knopflerfish.framework.BundleImpl.getUpdatedState(BundleImpl.java:1259)
        at org.knopflerfish.framework.BundleImpl.finalizeActivation(BundleImpl.java:312)
        at org.knopflerfish.framework.PermissionOps.callFinalizeActivation(PermissionOps.java:265)
        at org.knopflerfish.framework.BundleImpl.start(BundleImpl.java:295)
        at org.knopflerfish.bundle.frameworkcommands.FrameworkCommandGroup.cmdStart(FrameworkCommandGroup.java:1634)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at org.knopflerfish.service.console.CommandGroupAdapter.execute(CommandGroupAdapter.java:256)
        at org.knopflerfish.bundle.console.Command$2.run(Command.java:239)
        at java.security.AccessController.doPrivileged(AccessController.java:45)
        at org.knopflerfish.bundle.console.Command.run(Command.java:226)
        at java.lang.Thread.run(Thread.java:856)

最后,当我尝试运行pax-web-extender-war-0.8.0.jar (OPS4J Pax Web - Extender - War)时,也会出现以下错误消息:

代码语言:javascript
复制
[stderr] ## DEBUG: errors - FrameworkErrorEvent bundle #17
[stderr] ## DEBUG: errors - FrameworkErrorEvent throwable:
Couldn't start bundle: OPS4J Pax Web - Extender - WAR (#17) (due to: org.osgi.framework.BundleException: Bundle#17, unable to resolve: Missing package(s) or can not resolve all of the them:
org.osgi.service.http;version=[1.0.0,2.0.0) -- Could not resolve exporting bundle - org.osgi.service.http;version=1.2.0 Bundle[id=16,gen=0].
javax.servlet.http;version=2.1.0 -- Could not resolve exporting bundle - javax.servlet.http;version=2.5.0 Bundle[id=16,gen=0].
javax.servlet;version=2.1.0 -- Could not resolve exporting bundle - javax.servlet;version=2.5.0 Bundle[id=16,gen=0].)
org.osgi.framework.BundleException: Bundle#17, unable to resolve: Missing package(s) or can not resolve all of the them:
org.osgi.service.http;version=[1.0.0,2.0.0) -- Could not resolve exporting bundle - org.osgi.service.http;version=1.2.0 Bundle[id=16,gen=0].
javax.servlet.http;version=2.1.0 -- Could not resolve exporting bundle - javax.servlet.http;version=2.5.0 Bundle[id=16,gen=0].
javax.servlet;version=2.1.0 -- Could not resolve exporting bundle - javax.servlet;version=2.5.0 Bundle[id=16,gen=0].
        at org.knopflerfish.framework.BundleImpl.getUpdatedState(BundleImpl.java:1259)
        at org.knopflerfish.framework.BundleImpl.finalizeActivation(BundleImpl.java:312)
        at org.knopflerfish.framework.PermissionOps.callFinalizeActivation(PermissionOps.java:265)
        at org.knopflerfish.framework.BundleImpl.start(BundleImpl.java:295)
        at org.knopflerfish.bundle.frameworkcommands.FrameworkCommandGroup.cmdStart(FrameworkCommandGroup.java:1634)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at org.knopflerfish.service.console.CommandGroupAdapter.execute(CommandGroupAdapter.java:256)
        at org.knopflerfish.bundle.console.Command$2.run(Command.java:239)
        at java.security.AccessController.doPrivileged(AccessController.java:45)
        at org.knopflerfish.bundle.console.Command.run(Command.java:226)
        at java.lang.Thread.run(Thread.java:856)

我还尝试启动pax-web-jsp-1.0.2.jar (OPS4J Pax Web - Jsp Support),显示了此错误消息:

代码语言:javascript
复制
[stderr] ## DEBUG: errors - FrameworkErrorEvent bundle #15
[stderr] ## DEBUG: errors - FrameworkErrorEvent throwable:
Couldn't start bundle: OPS4J Pax Web - Jsp Support (#15) (due to: org.osgi.framework.BundleException: Bundle#15, unable to resolve: Missing package(s) or can not resolve all of the them:
javax.tools -- No providers found.
javax.servlet.resources;version=[2.3.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet.resources;version=2.5.0 Bundle[id=16,gen=0].
javax.servlet.http;version=[2.3.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet.http;version=2.5.0 Bundle[id=16,gen=0].
javax.servlet;version=[2.3.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet;version=2.5.0 Bundle[id=16,gen=0].
javax.lang.model.util -- No providers found.
javax.lang.model.type -- No providers found.
javax.lang.model.element -- No providers found.
javax.lang.model -- No providers found.
javax.annotation.processing -- No providers found.)
org.osgi.framework.BundleException: Bundle#15, unable to resolve: Missing package(s) or can not resolve all of the them:
javax.tools -- No providers found.
javax.servlet.resources;version=[2.3.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet.resources;version=2.5.0 Bundle[id=16,gen=0].
javax.servlet.http;version=[2.3.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet.http;version=2.5.0 Bundle[id=16,gen=0].
javax.servlet;version=[2.3.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet;version=2.5.0 Bundle[id=16,gen=0].
javax.lang.model.util -- No providers found.
javax.lang.model.type -- No providers found.
javax.lang.model.element -- No providers found.
javax.lang.model -- No providers found.
javax.annotation.processing -- No providers found.
        at org.knopflerfish.framework.BundleImpl.getUpdatedState(BundleImpl.java:1259)
        at org.knopflerfish.framework.BundleImpl.finalizeActivation(BundleImpl.java:312)
        at org.knopflerfish.framework.PermissionOps.callFinalizeActivation(PermissionOps.java:265)
        at org.knopflerfish.framework.BundleImpl.start(BundleImpl.java:295)
        at org.knopflerfish.bundle.frameworkcommands.FrameworkCommandGroup.cmdStart(FrameworkCommandGroup.java:1634)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at org.knopflerfish.service.console.CommandGroupAdapter.execute(CommandGroupAdapter.java:256)
        at org.knopflerfish.bundle.console.Command$2.run(Command.java:239)
        at java.security.AccessController.doPrivileged(AccessController.java:45)
        at org.knopflerfish.bundle.console.Command.run(Command.java:226)
        at java.lang.Thread.run(Thread.java:856)

根据我从错误消息中了解到的情况,这些包正在寻找这些包。有什么办法可以解决这个问题,并成功地使用OSGi框架在安卓上运行吗?

代码语言:javascript
复制
org.osgi.service.http;version=[1.1.0,2.0.0) -- Could not resolve exporting bundle - org.osgi.service.http;version=1.2.0 Bundle[id=16,gen=0].
javax.servlet.http;version=[2.5.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet.http;version=2.5.0 Bundle[id=16,gen=0].
javax.servlet;version=[2.5.0,3.0.0) -- Could not resolve exporting bundle - javax.servlet;version=2.5.0 Bundle[id=16,gen=0].

javax.security.sasl -- No providers found.
javax.management.remote -- No providers found.
javax.management.modelmbean -- No providers found.
javax.management -- No providers found.
EN

回答 1

Stack Overflow用户

发布于 2013-11-05 08:05:16

首先,我强烈建议对所有Pax-Web包使用相同的版本,其次,您缺少一个servlet包。而且,看起来您还缺少了另外几个Pax-Web包。您很可能需要以下包:

  • pax-web-api
  • pax-web-jetty-bundle
  • pax-web-jsp
  • pax-web-运行时
  • pax-web-spi

如果你想使用战争,你就需要

  • pax-web-扩展-战争
  • 和平与战争
  • 再来几个..。

最新版本的Pax是3.0.2,所以你应该根据你想做的事情仔细选择。您可能会发现,查看Pax的ITests (取决于您将要使用的版本)以获得需要在哪个捆绑包上的灵感是有帮助的。我建议从最低限度开始。这样,您首先从http-服务开始,并根据您的需要对其进行增强。

有关更多细节,请查看Pax-Web项目,特别是示例和itest模块。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19761188

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档