我们遇到了阻碍我们前进的问题。 我们在Apache karaf 3.0.3,地窖3.0.3中的项目效果很好。现在,我们升级到Apache karaf 4.2.0和Apache地窖4.1.0。而且我看到了这个错误
[activator-1-thread-2]错误 org.apache.karaf.features.internal.service.BootFeaturesInstaller- 安装启动功能时出错 org.osgi.service.resolver.ResolutionException:无法解析根目录: 缺少要求[root] osgi.identity; osgi.identity = OUR_FEATURE; 类型= karaf.feature;版本=“ [18.12.4,18.12.4]”; filter:=“(&(osgi.identity = OUR_FEATURE)(type = karaf.feature)(版本> = 18.12.4)(版本<= 18.12.4))” [原因:无法解决OUR_FEATURE / 18.12.4:缺少要求 [OUR_FEATURE / 18.12.4] osgi.identity; osgi.identity =地窖; type = karaf.feature [原因:无法解析地窖/4.1.0: 缺少要求[cellar / 4.1.0] karaf.cellar.provider [原因: 无法解决酒窖-hazelcast / 4.1.0:缺少要求 [cellar-hazelcast / 4.1.0] osgi.identity; osgi.identity = hazelcast; 类型= karaf.feature;版本=“ [3.8.1,3.8.1]” [原因:无法 解决hazelcast / 3.8.1:缺少要求[hazelcast / 3.8.1] osgi.identity; osgi.identity = com.hazelcast;类型= osgi.bundle; 版本=“ [3.8.1,3.8.1]”;分辨率:=必需 [原因:无法解决com.hazelcast / 3.8.1:缺少要求[com.hazelcast / 3.8.1] osgi.wiring.package; filter:=“(osgi.wiring.package = sun.misc)”] ]]]] *
*在org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42) 〜[?:?]在 org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:391) 〜[?:?]在 org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:377) 〜[?:?]在 org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:331) 〜[?:?]在 org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:248) 〜[?:?]在 org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388) 〜[?:?]在 org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025) 〜[?:?]在 org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda $ doProvisionInThread $ 13(FeaturesServiceImpl.java:964) 〜[?:?]在 org.apache.karaf.features.internal.service.FeaturesServiceImpl $$ Lambda $ 75 / 1531068986.call(未知 来源)〜[?:?]在 java.util.concurrent.FutureTask.run(FutureTask.java:266)[?:?]在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?] 在 java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) [?:?]在java.lang.Thread.run(Thread.java:745)[?:?]
我们看到,错误来自 com.hazelcast,版本3.8.1
实际上,过去我们使用 卡拉夫地窖和karaf 3.0.3 ,他们使用 com.hazelcast / hazelcast / version 3.4。 2 (https://mvnrepository.com/artifact/com.hazelcast/hazelcast/3.4.2)
现在有了 karaf 4.2.0和地窖4.1.0 ,他们使用 com.hazelcast / hazelcast-all / 3.8.1 https://mvnrepository.com/artifact/com.hazelcast/hazelcast-all/3.8.1 而该版本会导致此错误
这是我们的features.xml文件的内容
<repository>mvn:org.apache.karaf.cellar/apache-karaf-cellar/4.1.0/xml/features</repository>
<feature name="OUR_FEATURE" version="18.12.4" description="Our description">
<feature>cellar</feature>
<feature version="${project.version}">other_features</feature>
</feature>
我们尝试在安装(mvn全新安装)后搜索目标目录,并在目标文件夹中找到这些功能
<feature name="OUR_FEATURE" version="18.12.4" description="Our description">
<feature>cellar</feature>
<feature version="18.12.4">other_features</feature>
</feature>
<feature name="cellar" description="Karaf clustering" version="4.1.0">
<feature dependency="true">cellar-hazelcast</feature>
<feature>cellar-shell</feature>
<feature>cellar-config</feature>
<feature>cellar-bundle</feature>
<feature>cellar-features</feature>
<feature>cellar-kar</feature>
<requirement>
karaf.cellar.provider
</requirement>
</feature>
<feature name="cellar" description="Karaf clustering" version="4.1.0">
<feature dependency="true">cellar-hazelcast</feature>
<feature>cellar-shell</feature>
<feature>cellar-config</feature>
<feature>cellar-bundle</feature>
<feature>cellar-features</feature>
<feature>cellar-kar</feature>
<requirement>
karaf.cellar.provider
</requirement>
</feature>
<feature name="cellar-hazelcast" description="Cellar implementation based on Hazelcast" version="4.1.0">
<feature version="3.8.1">hazelcast</feature>
<feature version="4.1.0">cellar-core</feature>
<bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.hazelcast/4.1.0</bundle>
<bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.utils/4.1.0</bundle>
<capability>
karaf.cellar.provider;provider:=hazelcast
</capability>
</feature>
<feature name="hazelcast" description="In memory data grid" version="3.8.1">
<configfile finalname="/etc/hazelcast.xml">mvn:org.apache.karaf.cellar/apache-karaf-cellar/4.1.0/xml/hazelcast</configfile>
<bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
<bundle>mvn:com.eclipsesource.minimal-json/minimal-json/0.9.2</bundle>
<bundle>mvn:com.hazelcast/hazelcast-all/3.8.1</bundle>
</feature>
在我们的src / main / distribution / etc / config.properties中,我们已经有以下配置: org.osgi.framework.system.packages.extra = sun.misc
org.osgi.framework.bootdelegation = org.apache.karaf.jaas.boot,org.apache.karaf.jaas.boot.principal,org.apache.karaf.management.boot,sun。,com .sun。,javax.transaction,javax.transaction。,javax.xml.crypto,javax.xml.crypto。
org.osgi.framework.executionenvironment = J2SE-1.8,JavaSE-1.8,J2SE-1.7,JavaSE-1.7,J2SE-1.6,JavaSE-1.6,J2SE-1.5,JavaSE-1.5,J2SE-1.4, JavaSE-1.4,J2SE-1.3,JavaSE-1.3,J2SE-1.2,JavaSE-1.2,CDC-1.1 / Foundation-1.1,CDC-1.0 / Foundation-1.0,J2ME,OSGi / Minimum-1.1,OSGi / Minimum-1.0
在src / main / distribution / etc / custom.properties中,我们有以下配置:
karaf.systemBundlesStartLevel = 50 org.osgi.framework.system.packages.extra = org.apache.karaf.branding
请帮助我们解决此问题。
非常感谢
答案 0 :(得分:1)
我已经阅读了.m2 / com.hazelcast / hazelcast-all / 3.8.1 / hazelcast-all-3.8.1.jar的清单文件 我发现此清单文件的导入包中的 sun.misc
在版本3.4.2中,清单文件是.m2 / com.hazelcast / hazelcast / 3.4.2 / hazelcast-3.4.2.jar 我在此清单文件的导入包中发现 sun.misc; resolution:= optional
我认为OSGI容器在启动时不会导出sun.misc => hazelcast-all 3.8.1中的错误,因此我在 src / main / distribution / etc / config.properties中完成了这一行,,但它也不起作用。
org.osgi.framework.bootdelegation = org.apache.karaf.jaas.boot,org.apache.karaf.jaas.boot.principal,org.apache.karaf.management.boot,sun.misc。 ,sun.reflect。,sun。,com.sun。,javax.transaction,javax.transaction。,javax.xml.crypto,javax.xml .crypto。**
osgi.compatibility.bootdelegation = true
答案 1 :(得分:0)
在捆绑加载类但未为它们定义Import-Package语句时使用引导委托。
在您的情况下,hazelcast具有Import-Package语句。因此,要进行此项工作,必须从系统捆绑包中导出软件包。
要进行此编辑,config.properties
并将sun.misc
添加到org.osgi.framework.system.packages.extra
。
答案 2 :(得分:0)
非常感谢您的回答。如您所见,我已经写过:“在我们的src / main / distribution / etc / config.properties中,我们已经执行了以下配置:org.osgi.framework.system.packages.extra = sun.misc”但是它不起作用。
我认为org.osgi.framework.system.packages.extra = sun.misc将在系统级别导出sun.misc,但根本无法工作
答案 3 :(得分:0)
这是我的config.properties的提取
org.osgi.framework.system.packages= \
org.osgi.framework.startlevel;uses:="org.osgi.framework";version="1.0", \
org.osgi.framework.wiring;uses:="org.osgi.framework";version="1.1", \
org.osgi.framework.hooks.bundle;uses:="org.osgi.framework";version="1.1", \
org.osgi.framework.hooks.service;uses:="org.osgi.framework";version="1.1", \
org.osgi.framework.hooks.resolver;uses:="org.osgi.framework.wiring";version="1.0", \
org.osgi.framework.launch;uses:="org.osgi.framework";version="1.1", \
org.osgi.framework.namespace;uses:="org.osgi.resource";version="1.0", \
org.osgi.framework;version="1.7", \
org.osgi.framework.hooks.weaving;uses:="org.osgi.framework.wiring";version="1.0",\
org.osgi.resource;version="1.0",org.osgi.service.url;version="1.0",\
org.osgi.service.startlevel;uses:="org.osgi.framework";version="1.1",\
org.osgi.service.packageadmin;uses:="org.osgi.framework";version="1.2",\
org.osgi.service.url;version="1.0", \
org.osgi.util.tracker;uses:="org.osgi.framework";version="1.5.1", \
org.apache.karaf.jaas.boot;version="4.2.0", \
org.apache.karaf.jaas.boot.principal;version="4.2.0", \
org.apache.karaf.management.boot;version="4.2.0", \
org.apache.karaf.version;version="4.2.0", \
${jre-${java.specification.version}}
org.osgi.framework.system.packages.extra=sun.misc