2

我们正在尝试使用自定义构建的 spout java 代码通过 Apache Storm 集群从 Azure 服务总线 (ASB) 读取消息。当风暴拓扑提交以集群模式运行时,我们面临以下问题:

  • 未注册的服务或属性:com.microsoft.windowsazure.services.servicebus.ServiceBusContract 类 com.sun.jersey.api.client.Client
  • 无法添加 Azure 服务总线连接器
  • 服务设置失败。
  • 异步循环死了!

当以本地模式(无集群)提交相同的拓扑时,相同的代码可以正常工作并且能够接收来自 ASB 的消息。

从 java 环境访问 ASB 并能够解决此问题时,是否有人遇到过类似的问题?

4

3 回答 3

1

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

于 2015-05-28T14:51:33.530 回答
0

在 gradle 构建脚本中,我添加了这个插件

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

我使用了 shadowJar 任务而不是 jar 任务,我在其中给出了存档名称和主类。方法 mergeServiceFiles() 合并重复的服务文件名。

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

我希望这可以帮助别人

谢谢, Veeresh

于 2015-12-01T10:03:48.090 回答
0

我正在制作一个带有依赖关系的自定义 azure-service-bus 客户端的 jar,在我的情况下(Carlos/Robert)/ issue#466解决方法(maven-shade-plugin)不起作用。

我总是得到同样的错误:

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

注意:我刚刚在这里找到了可能与同一问题相关的另一张公开票:问题#465

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

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

azure-core和(0.8.3)依赖项都azure-servicebus使用嵌入“要导出的包”列表的相同文件(相同名称和相同位置)。这 2 个文件应该合并

我可悲的解决方法是使用 maven-assembly 的 2 次执行:

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

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

固定的 MS 合并结果文件(src/main/resources)是:

文件名

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>
于 2015-10-22T08:41:23.987 回答