我正在尝试在 Jboss Fuse 6.2.1 服务器(结构托管(中安装 hazelcast-all-3.6.5 版本。安装后,它会抛出以下错误。
Unable to update agent org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root]
osgi.identity; osgi.identity=appid1-hazelcast; type=karaf.feature; version=0
[caused by: Unable to resolve appid1-hazelcast/3.0.1.release: missing requirement [appid1-hazelcast/3.0.1.release]
osgi.identity; osgi.identity=com.hazelcast; type=osgi.bundle; version="[3.6.5,3.6.5]"; resolution:=mandatory
[caused by: Unable to resolve com.hazelcast/3.6.5: missing requirement [com.hazelcast/3.6.5]
osgi.wiring.package; filter:="(osgi.wiring.package=sun.misc)"]]
尝试安装片段包以公开 sun.misc 包,但收到以下错误">错误:资源没有 uri"。
片段包 : mvn:com.diffplug.osgi/com.diffplug.osgi.extension.sun.misc/0.0.0
2017-03-16 18:02:22,814 | INFO | 2.0.1-1-thread-1 | Agent | 72 - io.fabric8.fabric-agent - 1.2.0.redhat-621166 | null
2017-03-16 18:02:22,814 | ERROR | 2.0.1-1-thread-1 | DeploymentAgent | 72 - io.fabric8.fabric-agent - 1.2.0.redhat-621166 | Unable to update agent
java.lang.IllegalStateException: Resource has no uri
at io.fabric8.agent.service.Deployer.getBundleInputStream(Deployer.java:1466)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.service.Deployer.deploy(Deployer.java:812)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.service.Agent.provision(Agent.java:366)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.service.Agent.provision(Agent.java:199)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:733)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at io.fabric8.agent.DeploymentAgent$4.run(DeploymentAgent.java:289)[72:io.fabric8.fabric-agent:1.2.0.redhat-621166]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_55]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_55]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_55]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_55]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_55]
注意:相同的方法在 Fuse 6.1.0 版本(独立和结构(中工作正常。
您需要在 jboss 中激活对sun.misc.Unsafe
包的访问权限。通常,OSGi 框架有一些配置,您可以在其中启用来自系统类装入器的包到捆绑包中(引导类委派(。不确定它在 fabric8 中究竟是如何工作的,但这个较旧的帖子过去修复了它,猜测配置仍然相同:https://developer.jboss.org/message/884503#884503
最初,我将sun.misc包附加到etc/config.properties文件中的">org.osgi.framework.system.packages.extra"属性中,但这并没有解决问题。(这应该在 90% 的情况下有效(。
后来发现/etc/custom.properties 文件中还有一个名为">org.osgi.framework.system.packages.extra"的属性,将 sun.misc 包添加到/etc/custom.properties 文件解决了这个问题。
# Branding
org.osgi.framework.system.packages.extra = org.apache.karaf.branding,com.sun.xml.bind.v2.model.core,sun.misc