-
Notifications
You must be signed in to change notification settings - Fork 22
JKS not found and java.io.FileNotFoundException: https://discovery.meethue.com/ #62
Description
I am trying to run an example app. But it throws the following exception when I use it as written in README
Future<List<HueBridge>> bridgesFuture = new HueBridgeDiscoveryService()
.discoverBridges(bridge -> Log.d("000000","Bridge found: " + bridge));
final List<HueBridge> bridges;
try {
bridges = bridgesFuture.get();
} catch (ExecutionException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
if( !bridges.isEmpty() ) {
final String bridgeIp = bridges.get(0).getIp();
Log.d("000000","Bridge found at " + bridgeIp);
// Then follow the code snippets below under the "Once you have a Bridge IP address" header
}
E FATAL EXCEPTION: Thread-3
Process: com.example.hueconnect, PID: 6275
com.example.hueconnect.yahueapi.HueApiException: java.security.KeyStoreException: JKS not found
at com.example.hueconnect.yahueapi.SecureJsonFactory.(SecureJsonFactory.java:45)
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:131)
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:95)
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:63)
Caused by: java.security.KeyStoreException: JKS not found
at java.security.KeyStore.getInstance(KeyStore.java:904)
at com.example.hueconnect.yahueapi.SecureJsonFactory.createHueSSLContext(SecureJsonFactory.java:89)
at com.example.hueconnect.yahueapi.SecureJsonFactory.(SecureJsonFactory.java:35)
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:131)
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:95)
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:63)
Caused by: java.security.NoSuchAlgorithmException: JKS KeyStore not available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
at java.security.Security.getImpl(Security.java:628)
at java.security.KeyStore.getInstance(KeyStore.java:901)
at com.example.hueconnect.yahueapi.SecureJsonFactory.createHueSSLContext(SecureJsonFactory.java:89)
at com.example.hueconnect.yahueapi.SecureJsonFactory.(SecureJsonFactory.java:35)
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:131)
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:95)
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:63)
So I changed the line in SecureJsonFactory.java:
keystore = KeyStore.getInstance(KeyStore.getDefaultType());
//keystore = KeyStore.getInstance("JKS");
Now, I don't get the JKS not found error:
FATAL EXCEPTION: Thread-3
Process: com.example.hueconnect, PID: 9654
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.io.FileNotFoundException: https://discovery.meethue.com/
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:68)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.io.FileNotFoundException: https://discovery.meethue.com/
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:372)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2049)
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:66)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: https://discovery.meethue.com/
at com.example.hueconnect.yahueapi.discovery.NUPnPDiscoverer.lambda$discoverBridges$0$com-example-hueconnect-yahueapi-discovery-NUPnPDiscoverer(NUPnPDiscoverer.java:87)
at com.example.hueconnect.yahueapi.discovery.NUPnPDiscoverer$$ExternalSyntheticLambda0.get(Unknown Source:6)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1744)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1736)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:377)
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1185)
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1658)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1625)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.io.FileNotFoundException: https://discovery.meethue.com/
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:255)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:211)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:30)
at java.net.URL.openStream(URL.java:1072)
at com.fasterxml.jackson.core.TokenStreamFactory._optimizedStreamFromURL(TokenStreamFactory.java:262)
at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:1115)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3714)
at com.example.hueconnect.yahueapi.discovery.NUPnPDiscoverer.lambda$discoverBridges$0$com-example-hueconnect-yahueapi-discovery-NUPnPDiscoverer(NUPnPDiscoverer.java:81)
at com.example.hueconnect.yahueapi.discovery.NUPnPDiscoverer$$ExternalSyntheticLambda0.get(Unknown Source:6)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1744)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1736)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:377)
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1185)
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1658)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1625)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
what is wrong ?