我有我的 Tapestry Web 应用程序,它为某些数据集提供完整的 CRUD 功能。到目前为止,我一直在使用模拟来开发和测试它。
但是,我现在需要用 OSGi 服务(使用 Felix 运行)替换该模拟。
我的主要问题/问题是:
- 我是否需要将 OSGi 服务注入到我的挂毯应用程序中,如果需要,该怎么做?
- 假设它是注入的,有没有关于如何使用它的实践?我应该调用这些方法或类似的任何特殊方法吗?
- 在我调用了我需要的方法之后,我是否需要对它做一些事情,还是自动完成?
- 我需要担心吗
HttpService
(我看了一些关于它的抱怨,但不太明白)
为您提供一些背景信息,这就是我现在的做法
public class MyPage {
...
@Inject
private MyDao dao;
...
@Property
private List<Entry> entries;
...
void onPrepareForRender() {
...
this.entries = this.dao.getAll()
...
}
...
}
例如,我想要替换MyDao dao
为提供相同功能的 OSGi 服务,以便我可以在onPrepareForRender
方法中使用它。
我可以放心地假设与该服务关联的 OSGi 包已经在运行。
应用程序的其余部分作为 OSGi 应用程序制作。我在我的 pom.xml 中添加/更改了一些东西(maven-bundle-plugin,按照http://www.javabeat.net/2011/11/writing-an-osgi-web-application/中的说明添加了一些清单条目)。
但是,它仍然不起作用。
顺便说一句,我正在尝试将我的 WAR 转换为 WAB。
先感谢您 :)
编辑:从 WAR 转换和部署到 WAB 时出现问题
当我将我的网络应用程序打包为war
东西时,效果很好。但是,当我将它打包为bundle
,并尝试在 GlassFish 中部署它时,我收到以下错误消息:
部署期间发生错误:没有安装的容器能够处理此应用程序管理员战争。有关详细信息,请参阅 server.log。
当我转到 server.log 时,它是这样说的:
[#|2013-08-27T17:11:57.600+0200|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=28;_ThreadName=Thread-2;|uploadFileName=admin-war-2.01-SNAPSHOT.jar|#]
[#|2013-08-27T17:11:57.920+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:57.939+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=33;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:57.972+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:57.973+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:57.974+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:57.990+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:57.991+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:58.006+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:58.008+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:58.008+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:58.024+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:58.025+0200|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.com.sun.enterprise.deploy.shared|_ThreadID=29;_ThreadName=Thread-2;|DPL8031: Ignoring WEB-INF/ because the containing archive C:\glassfish3\glassfish\domains\domain1\applications\admin-war recorded it as a pre-existing stale file|#]
[#|2013-08-27T17:11:58.026+0200|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=29;_ThreadName=Thread-2;|Module type not recognized for module C:\glassfish3\glassfish\domains\domain1\applications\admin-war|#]
[#|2013-08-27T17:11:58.026+0200|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=29;_ThreadName=Thread-2;|There is no installed container capable of handling this application admin-war|#]
[#|2013-08-27T17:11:58.087+0200|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=28;_ThreadName=Thread-2;|Exception Occurred :Error occurred during deployment: There is no installed container capable of handling this application admin-war. Please see server.log for more details.|#]