Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Connecting to azure event hub: SunCertPathBuilderException

I'm not very used to java world, so I'm not sure if my problem is on my Azure set up, or java set up. I am getting the following exception after attempting the tutorial below.

https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-java-get-started-receive-eph

Failure while registering:     
com.microsoft.azure.eventprocessorhost.EPHConfigurationException:   
Encountered error while fetching the list of EventHub PartitionIds: 
sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to find 
valid certification path to requested target

The exception occurs during this line from the sample:

 host.registerEventProcessor(EventProcessor.class, options).get();

I did the .NET version of the tutorial with little problem. Sending and receiving works in that case. Any insights? I've been fumbling around with no luck the last few days.

like image 646
Seth Avatar asked Feb 10 '17 15:02

Seth


People also ask

How do I send data to Azure event hub?

Sign in to the Azure Portal. On the portal, click +New > Internet of Things > Event Hubs. In the "Create Namespace" blade, enter the name of your Event Hub in the name field, then choose the Standard Pricing Tier, and choose the desired subscription to create the Event Hub under it.


1 Answers

I searched for your issue and find some helpful blogs which can help solving the issue, please refer to the blogs below.

  1. https://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/
  2. http://nodsw.com/blog/leeland/2006/12/06-no-more-unable-find-valid-certification-path-requested-target

The above blogs all used the tool InstallCert to server certificate that can be added to local keystore. Please follow the README of the GitHub repository.

like image 143
Peter Pan Avatar answered Oct 21 '22 20:10

Peter Pan