public class App
{
public static void main( String[] args ) throws VaultException
{
final VaultConfig config =
new VaultConfig()
.build();
final Vault vault = new Vault(config);
try {
final String value = vault.logical()
.read("kv/hello")
.getData().get("foo");
System.out.format( "foo key in kv/hello is " + value +"\n");
} catch(VaultException e) {
System.out.println("Exception thrown: " + e);
}
}
}
However, I cannot read with that code the secret - it returns:
[root@localhost vault-java-example]# java -jar target/java-client-example-1.0-SNAPSHOT-jar-with-dependencies.jar
Constructing a Vault instance with no provided Engine version, defaulting to version 2.
Exception thrown: com.bettercloud.vault.VaultException: Vault responded with HTTP status code: 404
Response body: {"errors":[]}
I cannot make it work neither with KVv2, nor with KVv1 - using v4.0.0 of the Vault Java Driver. Some help will be highly appreciated!
I have:
And:
However, I cannot read with that code the secret - it returns: