vert-x3 / vertx-config

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

java.lang.IllegalArgumentException: unknown configuration store implementation: spring-config-server #106

Open oylshe1314 opened 4 years ago

oylshe1314 commented 4 years ago

dependencies {

compile 'io.vertx:vertx-core:4.0.0-milestone4'
compile 'io.vertx:vertx-config:4.0.0-milestone4'
compile 'io.vertx:vertx-config-spring-config-server:4.0.0-milestone4'

}

jar { manifest { attributes "Main-Class" : "io.vertx.core.Launcher", "Main-Verticle" : "com.sk.open.verticle.MainVerticle" }

from {
    configurations.compile.collect {
        it.isDirectory() ? it : zipTree(it)
    }
}

}

ConfigStoreOptions springStoreOptions = new ConfigStoreOptions(); springStoreOptions.setType("spring-config-server"); springStoreOptions.setConfig(new JsonObject().put("url", "http://localhost:10000/config/game-service/develop/server14"));

    ConfigRetrieverOptions retrieverOptions = new ConfigRetrieverOptions();
    retrieverOptions.addStore(springStoreOptions);

    ConfigRetriever retriever = ConfigRetriever.create(vertx, retrieverOptions);

    retriever.getConfig(event -> {
        if(event.failed()) {
            startPromise.fail(event.cause());
            return;
        }

        JsonObject config = event.result();
        System.out.println(config.toString());
    });

java.lang.IllegalArgumentException: unknown configuration store implementation: spring-config-server (known implementations are: [event-bus, file, json, http, env, sys, directory]) at io.vertx.config.impl.ConfigRetrieverImpl.(ConfigRetrieverImpl.java:111) at io.vertx.config.ConfigRetriever.create(ConfigRetriever.java:53) at com.sk.open.verticle.MainVerticle.start(MainVerticle.java:21) at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$5(DeploymentManager.java:209) at io.vertx.core.impl.AbstractContext.emit(AbstractContext.java:183) at io.vertx.core.impl.EventLoopContext.lambda$execute$0(EventLoopContext.java:42) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:510) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:518) at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:830)

gaol commented 4 years ago

It looks like the io.vertx.config.spring.SpringConfigServerStoreFactory was not detected by the ServiceLoader, since the vertx-config-spring-config-server has been added as a compile scope dependency, I suggest that you check whether the META-INF/services/io.vertx.config.spi.ConfigStoreFactory in the fat jar has correct items.