vert-x3 / vertx-config

Vert.x Configuration Service
Apache License 2.0
54 stars 64 forks source link

Missing transitive dependency on jackson-databind in vertx-config-yaml #100

Closed onyn closed 4 years ago

onyn commented 5 years ago

vertx-config-yaml example in vartx-config doc throws exception:

Stack trace ``` Exception in thread "main" java.util.ServiceConfigurationError: io.vertx.config.spi.ConfigProcessor: io.vertx.config.yaml.YamlProcessor Unable to get public no-arg constructor at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:583) at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:674) at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1233) at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1265) at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1300) at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1385) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:132) at io.vertx.config.spi.utils.Processors.(Processors.java:41) at io.vertx.config.impl.ConfigRetrieverImpl.(ConfigRetrieverImpl.java:120) at io.vertx.config.ConfigRetriever.create(ConfigRetriever.java:53) at Main.main(Main.java:17) Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3143) at java.base/java.lang.Class.getConstructor0(Class.java:3348) at java.base/java.lang.Class.getConstructor(Class.java:2157) at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:661) at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:658) at java.base/java.security.AccessController.doPrivileged(AccessController.java:551) at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:669) ... 9 more Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 17 more ```

Because dependency on com.fasterxml.jackson.core:jackson-databind is missing.

Reproducer ### pom.xml ```xml 4.0.0 hello world 1.0-SNAPSHOT 12 12 io.vertx vertx-config-yaml 4.0.0-milestone3 io.vertx vertx-config 4.0.0-milestone3 ``` ### Main.java ```java import io.vertx.config.ConfigRetriever; import io.vertx.config.ConfigRetrieverOptions; import io.vertx.config.ConfigStoreOptions; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; public class Main { public static void main(String[] args) { Vertx vx = Vertx.vertx(); ConfigRetrieverOptions cro = new ConfigRetrieverOptions().addStore( new ConfigStoreOptions() .setType("file") .setFormat("yaml") .setConfig(new JsonObject().put("path", "config.yml")) ); ConfigRetriever.create(vx, cro).getConfig(ar -> { if (ar.succeeded()) { System.out.println(ar.result().toString()); } else { ar.cause().printStackTrace(); } vx.close(); }); } } ```
gaol commented 4 years ago

jackson-databind has been added to vertx-config-yaml from 4.0.0-mileston4, so this should be fixed as well.