2014-11-25 35 views
2

我们正在尝试使用定制的喷口Java代码通过Apache Storm集群从Azure服务总线(ASB)读取消息。当风暴拓扑将被提交给集群模式下运行,我们正面临着以下问题:未注册从Storm集群访问Azure服务总线时出错

  • 服务或财产:com.microsoft.windowsazure.services.servicebus.ServiceBusContract类com.sun.jersey.api .client.Client
  • 无法添加Azure服务总线连接器
  • 服务设置失败。
  • 异步循环死亡!

当本地模式(没有集群)提交相同的拓扑时,相同的代码工作正常,能够从ASB接收消息。

从java环境访问ASB并能解决这个问题时,有没有人遇到类似的问题?

回答

1

请参阅https://github.com/Azure/azure-sdk-for-java/issues/466的解决方法。有阴影的瓶子存在问题,你只需要在pom.xml中包含一个新的转换器来解决问题。它为我工作。

+0

我无法使用这个插件来解决它:(截至今天,我唯一的解决方法是手动合并所产生的“ com.microsoft.windowsazure.core.Builder $ Exports“ – boly38 2015-10-21 13:13:17

0

我正在做一个JAR-与依赖性定制Azure的服务总线客户,在我的情况下(卡洛斯/罗伯特)/ issue#466解决方法(行家遮阳帘插件)无法正常工作。

我总是得到同样的错误:

Service or property not registered: com.microsoft.windowsazure.services.servicebus.ServiceBusContract class com.sun.jersey.api.client.Client 

NB:我刚刚发现了另一个公开售票是可能涉及到同样的问题在这里:issue#465

此错误的根本原因是以下错误资源:

META-INF/services/com.microsoft.windowsazure.core.Builder$Exports 

两个azure-coreazure-servicebus(0.8.3)的依赖使用相同的文件(相同的名称和s ame位置),它嵌入了“包输出”列表。 这2个文件应合并

我的悲伤解决方法是使用2个处决行家组装的:

  • 步骤A)第一执行使得依存关系目录,
  • 步骤B)第二执行追加我的版本固定Builder$Exports资源的,删除MS签名的文件(安全问题),并创建一个最终的jar文件。

此解决方案尚不可接受,因为固定资源未从天青依赖中选取。我有我自己的额外资源。但是今天我没有其他的解决方法。

固定MS合并结果文件中(src /主/资源)为:

文件名

META-INF/services/com.microsoft.windowsazure.core.Builder$Exports 

文件内容

com.microsoft.windowsazure.services.servicebus.Exports 
com.microsoft.windowsazure.services.servicebus.implementation.Exports 
com.microsoft.windowsazure.core.pipeline.apache.Exports 
com.microsoft.windowsazure.core.pipeline.jersey.Exports 
com.microsoft.windowsazure.core.utils.Exports 
com.microsoft.windowsazure.credentials.Exports 
com.microsoft.windowsazure.management.configuration.Exports 

POM插件定义:

  <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <version>2.4</version> 
       <executions> 
        <execution> 
         <id>dir-jar-with-dependencies</id><!-- step A --> 
         <phase>package</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
         <configuration> 
          <descriptors> 
           <descriptor>src/assembly/dir_jardeps.xml</descriptor> 
          </descriptors> 
          <finalName>busclient</finalName> 
          <appendAssemblyId>false</appendAssemblyId> 
         </configuration> 
        </execution> 
        <execution> 
         <id>jar-with-dependencies-ms-patch</id><!-- step B --> 
         <phase>package</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
         <configuration> 
          <archive> 
           <manifest> 
            <mainClass>${mainclass}</mainClass> 
           </manifest> 
          </archive> 
          <descriptors> 
           <descriptor>src/assembly/jardeps_mspatch.xml</descriptor> 
          </descriptors> 
          <finalName>busclient</finalName> 
          <appendAssemblyId>false</appendAssemblyId> 
         </configuration> 
        </execution> 

文件src/assembly/dir_jardeps.xml

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> 
    <id>dir-jar-with-dependencies</id> 
    <formats> 
     <format>dir</format> 
    </formats> 
    <includeBaseDirectory>false</includeBaseDirectory> 
    <dependencySets> 
     <dependencySet> 
      <outputDirectory>/</outputDirectory> 
      <useProjectArtifact>true</useProjectArtifact> 
      <unpack>true</unpack> 
      <scope>runtime</scope> 
     </dependencySet> 
    </dependencySets> 
</assembly> 

文件src/assembly/dir_jardeps.xml

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> 
    <id>dir-jar-with-dependencies</id> 
    <formats> 
     <format>jar</format> 
    </formats> 
    <includeBaseDirectory>false</includeBaseDirectory> 
    <fileSets> 
     <fileSet> 
      <directory>${project.build.directory}/classes/META-INF</directory> 
      <outputDirectory>META-INF</outputDirectory> 
     </fileSet> 
     <fileSet> 
      <directory>${project.build.directory}/busclient</directory> 
      <outputDirectory>/</outputDirectory> 
      <excludes> 
      <exclude>META-INF/services/com.microsoft.windowsazure.core.Builder$Exports</exclude> 
      <!-- MS jars are signed : remove signatures --> 
      <exclude>META-INF/*.SF</exclude> 
      <exclude>META-INF/*.DSA</exclude> 
      <exclude>META-INF/*.RSA</exclude> 
      </excludes> 
     </fileSet> 
    </fileSets> 
</assembly> 
+1

这就是阴影jar插件应该做的事情,值得注意的是,很快我们就不需要做这样的事情了,新版本的Java SDK将很快推出,不会有服务加载器问题。 – Justice 2015-10-22 16:06:41

+0

感谢@Justice的信息。你知道什么时候发布会完成(任何日期/链接?)? – boly38 2015-10-22 18:35:39

+0

他们应该在11月份开始回购。发电机的工作正在http://github.com/azure/autorest完成。 – Justice 2015-10-26 16:40:54

0

在gradle这个构建脚本我加入这个插件

apply plugin: 'com.github.johnrengelman.shadow' 

相反的jar任务我用shadowJar任务中我给了压缩文件名和主类。 mergeServiceFiles()方法合并重复的服务文件名。

shadowJar { 
archiveName = "sample.jar" 
manifest { 
attributes 'Main-Class': ' com.test.asset.Test' 
} 
mergeServiceFiles() 
} 

我希望这有助于有人

感谢, Veeresh