简体   繁体   English

Glassfish 3.1.2.2和重用Bundle ID

[英]Glassfish 3.1.2.2 and reusing Bundle ID

Here's an interesting think I've observed and which has puzzled me for some time now. 这是我观察到的一个有趣的想法,这使我困惑了一段时间。

I'm using Glassfish 3.1.2.2 which I deploy multiple OSGi bundles on. 我正在使用我在上面部署多个OSGi捆绑软件的Glassfish 3.1.2.2。

When I want to replace the bundles with new versions/revisions I have to uninstall and then install bundles. 当我想用新版本/修订版替换捆绑包时,我必须先uninstall然后再install捆绑包。

Normally, I'd assume Glassfish can reuse old bundle ids that aren't present any more, but it just continues. 通常,我假设Glassfish可以重用不再显示的旧包ID,但它会继续存在。 For example, let's say that Glassfish bundles go to ID of 100, and my own bundles start go from 101 to 200. 例如,假设Glassfish捆绑包的ID为100,而我自己的捆绑包的ID从101开始到200。

When I uninstall old bundles and install new ones, I'd assume that the bundle ID in range 101-200 would be reusable. 当我卸载旧的捆绑软件并安装新的捆绑软件时,我假设101-200范围内的捆绑软件ID是可重用的。

Instead, my new bundles have their IDs from 201 to 300. 相反,我的新捆绑包的ID从201到300。

I'm uninstalling them like this: 我像这样卸载它们:

uninstall <bundle id>

and installing like this: 并像这样安装:

install file:<path-to-bundle>

How to resolve this problem so that Glassfish reuses old bundle IDs? 如何解决此问题,以便Glassfish重用旧的包ID?

Edit: 编辑:

I have found a folder named bundle0 in glassfish3\\glassfish\\domains\\domain1\\osgi-cache\\felix which contains a file named bundle.id with a single number, which seems to be something like a DB sequence, noting the last bundle id used. 我在glassfish3\\glassfish\\domains\\domain1\\osgi-cache\\felix中找到了一个名为bundle0的文件夹,其中包含一个名为bundle.id的文件,该文件bundle.id一个数字,似乎像一个数据库序列,注意最后使用的bundle ID 。

In order for me to manually change the starting bundle id with the following bundle installations, I have to do the following, in this order: 为了使我可以手动更改以下安装的捆绑包的开始捆绑包ID,我必须按以下顺序执行以下操作:

  1. Uninstall my bundles via GoGo console 通过GoGo控制台卸载我的捆绑软件
  2. Stop Glassfish 停止玻璃鱼
  3. Delete bundle<ID> folders of my bundles in glassfish3\\glassfish\\domains\\domain1\\osgi-cache\\felix glassfish3\\glassfish\\domains\\domain1\\osgi-cache\\felix删除我的捆绑bundle<ID>文件夹
  4. Change the number in bundle.id file to some reasonable number bundle.id文件中的数字更改为合理的数字
  5. Start Glassfish - it will increment the number in bundle.id file 启动Glassfish-将增加bundle.id文件中的数字
  6. Install new versions of my bundles 安装我的捆绑软件的新版本

As you can imagine, I do not want to do this every time I want to do a release/upgrade. 如您所料,我不想每次执行发行/升级时都执行此操作。 Can Glassfish do this by itself, or do I need to create a script of some sort that will do this for me? Glassfish可以单独执行此操作,还是需要创建某种脚本来为我执行此操作?

The OSGi spec requires bundle ids to not be reused. OSGi规范要求捆绑包ID不能重复使用。 Note: you can update a bundle in place rather than uninstall/install. 注意:您可以就地更新捆绑包,而不是卸载/安装。 When you update, the bundle id is preserved. 更新时,捆绑包ID将保留。

Why do you want to keep the same IDs? 为什么要保留相同的ID? As BJ mentioned you're not supposed to do this, so you're probably approaching another problem the wrong way. 正如BJ提到的那样,您不应该这样做,所以您可能正以错误的方式处理另一个问题。

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

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