Improve exception message when validating (missing) key stores.

Description

We should catch this and log a more sensible error rather than looking at the stack trace.

Need to verify whether this is printed to the console or is via the log file (or both)

```[ERROR] 2018-12-21T15:48:48,686Z [main] internal.Node.getCertificateStores - IO exception while trying to validate keysto
res and truststore [errorCode=vz4adc, moreInformationAt=https://errors.corda.net/OS/4.0-SNAPSHOT/vz4adc]
java.nio.file.NoSuchFileException: /opt/corda/certificates/sslkeystore.jks
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) ~[?:1.8.0_192]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:1.8.0_192]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:1.8.0_192]
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214) ~[?:1.8.0_192]
at java.nio.file.Files.newByteChannel(Files.java:361) ~[?:1.8.0_192]
at java.nio.file.Files.newByteChannel(Files.java:407) ~[?:1.8.0_192]
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384) ~[?:1.8.0_192]
at java.nio.file.Files.newInputStream(Files.java:152) ~[?:1.8.0_192]
at net.corda.core.internal.PathUtilsKt.inputStream(PathUtils.kt:126) ~[corda-core-4.0-SNAPSHOT.jar:?]
at net.corda.nodeapi.internal.crypto.KeyStoreUtilities.loadKeyStore(KeyStoreUtilities.kt:163) ~[corda-node-api-4.0-SNAPSHOT.jar:?]
at net.corda.nodeapi.internal.crypto.X509KeyStore$Companion.fromFile(X509KeyStore.kt:32) ~[corda-node-api-4.0-SNAPSHOT.jar:?]
at net.corda.nodeapi.internal.config.CertificateStore$Companion.fromFile(CertificateStore.kt:21) ~[corda-node-api-4.0-SNAPSHOT.jar:?]
at net.corda.nodeapi.internal.config.FileBasedCertificateStoreSupplier.get(CertificateStoreSupplier.kt:22) ~[corda-node-api-4.0-SNAPSHOT.jar:?]
at net.corda.nodeapi.internal.config.CertificateStoreSupplier$DefaultImpls.get$default(CertificateStoreSupplier.kt:8) ~[corda-node-api-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.AbstractNode.getCertificateStores(AbstractNode.kt:724) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.AbstractNode.validateKeyStores(AbstractNode.kt:739) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.AbstractNode.initKeyStores(AbstractNode.kt:277) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:313) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.Node.start(Node.kt:413) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:176) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartupCli$runProgram$2.run(NodeStartup.kt:105) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:157) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:112) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartupLogging$DefaultImpls.attempt(NodeStartup.kt:438) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup.attempt(NodeStartup.kt:112) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup.initialiseAndRun(NodeStartup.kt:155) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartupCli.runProgram(NodeStartup.kt:103) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.cliutils.CordaCliWrapper.call(CordaCliWrapper.kt:184) ~[corda-tools-cliutils-4.0-SNAPSHOT.jar:?]
at net.corda.cliutils.CordaCliWrapper.call(CordaCliWrapper.kt:152) ~[corda-tools-cliutils-4.0-SNAPSHOT.jar:?]
at picocli.CommandLine.execute(CommandLine.java:1056) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine.access$900(CommandLine.java:142) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine$RunLast.handle(CommandLine.java:1246) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine$RunLast.handle(CommandLine.java:1214) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1122) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine.parseWithHandlers(CommandLine.java:1405) ~[picocli-3.8.0.jar:3.8.0]
at net.corda.cliutils.CordaCliWrapperKt.start(CordaCliWrapper.kt:72) ~[corda-tools-cliutils-4.0-SNAPSHOT.jar:?]
at net.corda.node.Corda.main(Corda.kt:13) ~[corda-node-4.0-SNAPSHOT.jar:?]
[ERROR] 2018-12-21T15:48:48,719Z [main] internal.NodeStartupLogging.invoke - Exception during node startup: One or more keyStores (identity or TLS) or trustStore not found. Please either copy your existing keys and certificates from another node, or if you don't have one yet, fill out the config file and run corda.jar initial-registration. Read more at: https://docs.corda.net/permissioning.html [errorCode=16fn52g, moreInformationAt=https://errors.corda.net/OS/4.0-SNAPSHOT/16fn52g]
java.lang.IllegalArgumentException: One or more keyStores (identity or TLS) or trustStore not found. Please either copy your existing keys and certificates from another node, or if you don't have one yet, fill out the config file and run corda.jar initial-registration. Read more at: https://docs.corda.net/permissioning.html
at net.corda.node.internal.AbstractNode.validateKeyStores(AbstractNode.kt:739) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.AbstractNode.initKeyStores(AbstractNode.kt:277) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:313) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.Node.start(Node.kt:413) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:176) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartupCli$runProgram$2.run(NodeStartup.kt:105) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:157) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:112) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartupLogging$DefaultImpls.attempt(NodeStartup.kt:438) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup.attempt(NodeStartup.kt:112) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartup.initialiseAndRun(NodeStartup.kt:155) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.node.internal.NodeStartupCli.runProgram(NodeStartup.kt:103) ~[corda-node-4.0-SNAPSHOT.jar:?]
at net.corda.cliutils.CordaCliWrapper.call(CordaCliWrapper.kt:184) ~[corda-tools-cliutils-4.0-SNAPSHOT.jar:?]
at net.corda.cliutils.CordaCliWrapper.call(CordaCliWrapper.kt:152) ~[corda-tools-cliutils-4.0-SNAPSHOT.jar:?]
at picocli.CommandLine.execute(CommandLine.java:1056) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine.access$900(CommandLine.java:142) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine$RunLast.handle(CommandLine.java:1246) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine$RunLast.handle(CommandLine.java:1214) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1122) ~[picocli-3.8.0.jar:3.8.0]
at picocli.CommandLine.parseWithHandlers(CommandLine.java:1405) ~[picocli-3.8.0.jar:3.8.0]
at net.corda.cliutils.CordaCliWrapperKt.start(CordaCliWrapper.kt:72) ~[corda-tools-cliutils-4.0-SNAPSHOT.jar:?]
at net.corda.node.Corda.main(Corda.kt:13) ~[corda-node-4.0-SNAPSHOT.jar:?]```

Status

Assignee

Wawrzek Niewodniczański

Reporter

Wawrzek Niewodniczański

Labels

None

Feature Team

Operational Experience

Story Points

1

Fix versions

None

Ported to...

None

Priority

Medium

Sprint

Affects versions

Configure