151

それぞれマニフェストのみを含む 4 つのバンドルがあります。バンドルは

  • appインポートcom.example.foo.fragmentcom.example.bar
  • foo輸出するcom.example.foo;uses:=com.example.foo.cfg
  • foo.fragmentfooこれは、そのエクスポートに添付されたフラグメントでcom.example.foo.fragmentあり、com.example.foo.fragment.cfg;uses:=com.example.foo.fragment
  • bar輸出入com.example.bar_com.example.foo

バンドル レベルの依存関係グラフ:

app -> bar
|       |
|       v
|      foo
|       |
v       v
foo.fragment

これらのバンドルを一度に JBoss AS 7.2 にインストールすると、問題なく動作します。しかし、最初に、または正常に起動してからアンインストールした後に、他のappバンドルの後にバンドルをインストールすると、次の使用制約違反が発生します。

Caused by: org.osgi.service.resolver.ResolutionException: Uses constraint violation. Unable to resolve resource com.example.app [HostBundleRevision[com.example.app:0.0.
0]] because it is exposed to package 'com.example.foo.fragment' from resources com.example.foo [HostBundleRevision[com.example.foo:0.0.0]] and com.example.foo [HostBund
leRevision[com.example.foo:0.0.0]] via two dependency chains.

Chain 1:
  com.example.app [HostBundleRevision[com.example.app:0.0.0]]
    import: null
     |
    export: osgi.wiring.package=com.example.foo.fragment
  com.example.foo [HostBundleRevision[com.example.foo:0.0.0]]

Chain 2:
  com.example.app [HostBundleRevision[com.example.app:0.0.0]]
    import: null
     |
    export: osgi.wiring.package=com.example.bar; uses:=com.example.foo
  com.example.bar [HostBundleRevision[com.example.bar:0.0.0]]
    import: null
     |
    export: osgi.wiring.package=com.example.foo; uses:=com.example.foo.fragment
    export: osgi.wiring.package=com.example.foo.fragment
  com.example.foo [HostBundleRevision[com.example.foo:0.0.0]]
        at org.apache.felix.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1142)
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:197)
        at org.jboss.osgi.resolver.felix.StatelessResolver.resolve(StatelessResolver.java:56)
        at org.jboss.osgi.framework.internal.ResolverImpl.resolveAndApply(ResolverImpl.java:137)
        at org.jboss.as.osgi.service.BundleLifecycleIntegration$BundleLifecycleImpl.activateDeferredPhase(BundleLifecycleIntegration.java:296)
        ... 31 more

完全なマニフェストは次のとおりです。

app.jar/META-INF/MANIFEST.MF
----------------------------
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.example.app
Import-Package: com.example.foo.fragment,com.example.bar
----------------------------
foo.jar/META-INF/MANIFEST.MF
----------------------------
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.example.foo
Export-Package: com.example.foo;uses:="com.example.foo.cfg"
-------------------------------------
foo.fragment.jar/META-INF/MANIFEST.MF
-------------------------------------
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.example.foo.fragment
Fragment-Host: com.example.foo
Export-Package: com.example.foo.fragment,com.example.foo.cfg;uses:="co
 m.example.foo.fragment"
----------------------------
bar.jar/META-INF/MANIFEST.MF
----------------------------
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.example.bar
Export-Package: com.example.bar;uses:="com.example.foo"
Import-Package: com.example.foo

スタンドアロンの Apache Felix 4.2.1 で上記のエラーを再現できませんでした。

この動作の原因は何ですか? マニフェストFragment-Host: com.example.fooから行を削除すると、エラーなしで再インストールできます。これは JBoss AS 7.2 のバグですか?foo.fragmentapp

4

1 に答える 1

1

アプリに foo.fragment をインポートする必要はありません。依存関係は foo から解決されます。したがって、その依存関係を削除して再デプロイするだけです。この問題は循環依存が原因です。

于 2015-01-28T07:31:12.127 に答える