square / keywhiz

A system for distributing and managing secrets
https://square.github.io/keywhiz/
Apache License 2.0
2.62k stars 216 forks source link

Broken on Java 9 and 10 #376

Closed mbyczkowski closed 6 years ago

mbyczkowski commented 6 years ago

Keywhiz crashes when Java 9 or 10 is used.

Java 10:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home
java -cp ./server/target/keywhiz-server-0.8.1-SNAPSHOT-shaded.jar:./haas-provider.jar keywhiz.KeywhizService server ./server/src/main/resources/keywhiz-development.yaml
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1009)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:801)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:699)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:622)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:110)
        at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:96)
        at org.hibernate.validator.HibernateValidator.createSpecializedConfiguration(HibernateValidator.java:37)
        at org.hibernate.validator.HibernateValidator.createSpecializedConfiguration(HibernateValidator.java:34)
        at javax.validation.Validation$ProviderSpecificBootstrapImpl.configure(Validation.java:220)
        at io.dropwizard.setup.Bootstrap.<init>(Bootstrap.java:71)
        at io.dropwizard.Application.run(Application.java:68)
        at keywhiz.KeywhizService.main(KeywhizService.java:72)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationException
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 17 more

Java 9:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
java -cp ./server/target/keywhiz-server-0.8.1-SNAPSHOT-shaded.jar:./haas-provider.jar keywhiz.KeywhizService server ./server/src/main/resources/keywhiz-development.yaml
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1007)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:801)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:699)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:622)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
        at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:110)
        at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:96)
        at org.hibernate.validator.HibernateValidator.createSpecializedConfiguration(HibernateValidator.java:37)
        at org.hibernate.validator.HibernateValidator.createSpecializedConfiguration(HibernateValidator.java:34)
        at javax.validation.Validation$ProviderSpecificBootstrapImpl.configure(Validation.java:220)
        at io.dropwizard.setup.Bootstrap.<init>(Bootstrap.java:71)
        at io.dropwizard.Application.run(Application.java:68)
        at keywhiz.KeywhizService.main(KeywhizService.java:72)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationException
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
        ... 17 more
mcpherrinm commented 6 years ago

I think as a workaround, you can add --add-modules java.xml.bind to your java invocation.

Though we'll want to fix this properly still.

mbyczkowski commented 6 years ago

Keywhiz has been updated to work with JDK11 now.