0

I'm having issues with a

Exception in thread "main" java.lang.RuntimeException: Service or property not registered:  com.microsoft.azure.keyvault.KeyVaultClient class org.apache.http.impl.client.HttpClientBuilder

I looked at https://github.com/Azure/azure-sdk-for-java/issues/465

and saw the same issue for servicebus. However, I tried shading my jar and still it did not solve the problem.

Are there known fixes for this?

my build is as follows:

 <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.5.1</version>
    <configuration>
      <source>1.7</source>
      <source>1.7</source>
    </configuration>
      </plugin>

       <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.4.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin> 
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>com.App</mainClass>
            </manifest>
          </archive>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
      </plugin>
    </plugins>
  </build>

In addition I get the error:

exception in thread "main" java.lang.RuntimeException: Service or property not registered:  com.microsoft.azure.keyvault.KeyVaultClient class org.apache.http.impl.client.HttpClientBuilder
        at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:198)
        at com.microsoft.windowsazure.core.DefaultBuilder$1.create(DefaultBuilder.java:138)
        at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200)
        at com.microsoft.windowsazure.Configuration.create(Configuration.java:113)
        at com.microsoft.azure.keyvault.KeyVaultClientService.create(KeyVaultClientService.java:48)
        at com.microsoft.ac.configuration.KeyVaultHelper.initialize(KeyVaultHelper.java:27)
        at com.microsoft.ac.App.main(App.java:21)
user3750474
  • 249
  • 5
  • 18
sam smith
  • 1
  • 2
  • Did you want to export a runnable jar file using Maven? Or using Eclipse in the meantime? May refer to the SO thread http://stackoverflow.com/questions/2022032/building-a-runnable-jar-with-maven-2 which is helpful. If using Eclipse within Maven, please don't forget to enable `Package required libraries into generated JAR` option. – Peter Pan Jan 16 '17 at 17:25
  • I added the complete exception – sam smith Jan 18 '17 at 05:00
  • I'm trying to package a runnable jar and i create it using mvn package assembly:single. Should I be doing something different ? – sam smith Jan 18 '17 at 05:00
  • Please follow the answer of the SO thread http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven to try to modify your `pom.xml` file to solve your problem. – Peter Pan Jan 18 '17 at 09:52
  • In the GitHub issue you shared there is a mention to a an explanation and workaround in [this other GitHub issue](https://github.com/Azure/azure-sdk-for-java/issues/466#issuecomment-77124753), maybe this could help. – vcolin7 Jan 16 '21 at 02:07

0 Answers0