简体   繁体   English

在构建Maven之后,OSGi软件包始终处于“开始”状态

[英]OSGi bundle always has a 'starting' status after maven build

So I have tried adding a new bundle to my project. 因此,我尝试将新捆绑包添加到我的项目中。 Everything works perfectly in Eclipse Equinox but there is a problem with the Maven (Tycho) build. 一切都可以在Eclipse Equinox上完美运行,但是Maven(Tycho)构建存在问题。 My bundle is visible in OSGi console and its status is STARTING but it would't start when its service is needed. 我的捆绑软件在OSGi控制台中可见,其状态为STARTING,但在需要其服务时无法启动。 I can start the bundle manually from the OSGi console and then it works. 我可以从OSGi控制台手动启动捆绑软件,然后它可以工作。 I can even restart my app after that and it still works. 之后,我什至可以重新启动我的应用程序,但它仍然可以正常工作。

When I go into bundles.info I can see this line: 当我进入bundles.info时,我可以看到以下行:

org.eclipse.orion.server.authentication.github,1.0.0.v20151013-0508,plugins/org.eclipse.orion.server.authentication.github_1.0.0.v20151013-0508.jar,4,false

If I change 'false' to 'true' at the end then it also works. 如果最后我将'false'更改为'true',那么它也有效。 How to configure my bundle to make it 'true' by default? 如何配置我的捆绑包使其默认为“ true”?

The larger story behind my bundle (let's call it A) is: It implements an interface defined in bundle B (so A requires B) and registers a service under this interface. 我的包背后的大故事(我们称其为A)是:它实现了在包B中定义的接口(因此A要求B)并在此接口下注册服务。 This service is used inside B (B does not know about A before runtime). 该服务在B内部使用(B在运行前不知道A)。 I heard removing this kind of cyclic dependency could help but I don't want to modify B to avoid merge conflicts. 我听说删除这种周期性依赖关系可能会有所帮助,但我不想修改B以避免合并冲突。

Maybe this is not a real problem. 也许这不是一个真正的问题。 It is a typical behaviour of Equinox. 这是Equinox的典型行为。 It shows bundles as starting until another bundle actually needs the service the bundle is offering. 它将捆绑软件显示为开始,直到另一个捆绑软件实际需要该捆绑软件提供的服务为止。 So typically you can just ignore the status starting in equinox. 因此,通常您可以忽略以春分点开始的状态。

Alternatively you can run your bundles on felix where they should be reported as Active. 另外,您也可以在felix上运行捆绑软件,将其报告为Active。

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

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