Search code examples
javaazureazure-eventhub

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://learn.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.


Solution

  • Turns out it was a stupid network problem. The amqp port is whitelist only.