ServiceBus JAVA SDK先进的重装错误的ServiceLoader(未亚型) [英] ServiceBus JAVA SDK advanced reloading errors, ServiceLoader (not subtype)

查看:366
本文介绍了ServiceBus JAVA SDK先进的重装错误的ServiceLoader(未亚型)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有运行某些包OSGi环境,其中一人使用服务总线API(Azure的Java SDK的v 0.4.4),并存在一定的误区后,我重新加载OSGi环境。工作流程是这样的:

I have an OSGi environment running some bundles, one of them uses Service Bus API (Azure Java SDK v 0.4.4) and there are some errors after I reload my OSGi environment. The workflow is this:


  • 初始化JVM和OSGi框架

  • 捆绑的加载和启动

  • 服务总线束创建一个使用ServiceBusConfiguration.configureWithWrapAuthentication(V,W,X,Y,Z)呼叫的配置和一切顺利

  • Initialize the JVM and the OSGi framework
  • Bundles are loaded and started
  • Service Bus bundle creates a Configuration using "ServiceBusConfiguration.configureWithWrapAuthentication(v,w,x,y,z)" call and everything runs smoothly

我重新编程OSGi框架,然后所有的包被加载并再次启动

I programmatically restart the OSGi framework and then all bundles are loaded and started again

异常螺纹线程7java.util.ServiceConfigurationError:com.microsoft.windowsazure.services.core.Builder $出口额:提供com.microsoft.windowsazure.services.blob.Exports不亚型
    在java.util.ServiceLoader.fail(ServiceLoader.java:231)
    在java.util.ServiceLoader.access $ 300(ServiceLoader.java:181)
    在java.util.ServiceLoader $ LazyIterator.next(ServiceLoader.java:369)
    在java.util.ServiceLoader $ 1.next(ServiceLoader.java:445)
    在com.microsoft.windowsazure.services.core.DefaultBuilder.create(DefaultBuilder.java:43)
    在com.microsoft.windowsazure.services.core.Configuration<&初始化GT;(Configuration.java:52)
    在com.microsoft.windowsazure.services.core.Configuration.load(Configuration.java:78)
    在com.microsoft.windowsazure.services.core.Configuration.getInstance(Configuration.java:63)
    在com.microsoft.windowsazure.services.serviceBus.ServiceBusConfiguration.configureWithWrapAuthentication(ServiceBusConfiguration.java:88)

一些调试我看到,它可能是与一个的ServiceLoader发出后,更准确地说,当它会检查 com.microsoft.windowsazure.services.blob.Exports 是子类或工具 com.microsoft.windowsazure.services.core.Builder $出口这也被第一次运行时检查之后

After some debugging I see that it could be an issue with the ServiceLoader, more exactly when it checks if the com.microsoft.windowsazure.services.blob.Exports is a subclass or implements com.microsoft.windowsazure.services.core.Builder$Exports which is also being checked after during the first run.

所以,在我看来,必须有一些prevents服务的正确重装,但我已经无法找出确切的发生。

So in my opinion there must be something that prevents the proper reload of the Services but I've not been able to figure out what's exactly happening.

希望你们中的任何有关于线索!

Hope any of you has a clue about that!

推荐答案

的ServiceLoader是JRE类库的一部分,它没有意识OSGi的类加载。当您重新启动OSGi框架,所有的包拿到新的类加载器,从而从包中加载的类也比以前不同的类的对象。如果实例的ServiceLoader生存的框架重新启动,它仍然会引用原始类的对象。

ServiceLoader is part of the JRE class libs and it unware of OSGi class loading. When you restart an OSGi framework, all the bundles get new class loaders and thus the loaded classes from bundles are different class objects than before. If the ServiceLoader instance survives the framework restart, it will still be referencing the original class object.

这篇关于ServiceBus JAVA SDK先进的重装错误的ServiceLoader(未亚型)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆