Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException when running fat jar with additional store dependency #75

Closed
jjank opened this issue Feb 11, 2019 · 3 comments
Closed

Comments

@jjank
Copy link

jjank commented Feb 11, 2019

Hi everybody,

I've encountered some minor issue when working with additional ConfigStores. I've created a little example app using the Kubernetes ConfigMap Store but the issue applies for all additional config stores.

According to the documentation one has to include both the vertx-config and the vertx-config-kubernetes-configmap artifacts as dependencies.

When you run the my example app on the broken branch via the maven exec-plugin or via a main-method, everything works fine. However if you run the fat jar I get an exception:

mvn clean package && java -jar target/config-demo-1.0.0-SNAPSHOT-fat.jar
java.lang.IllegalArgumentException: unknown configuration store implementation: configmap (known implementations are: [event-bus, file, json, http, env, sys, directory])
	at io.vertx.config.impl.ConfigRetrieverImpl.<init>(ConfigRetrieverImpl.java:110)
	at io.vertx.config.ConfigRetriever.create(ConfigRetriever.java:52)
	at com.github.wengertj.configdemo.MainVerticle.start(MainVerticle.java:21)
	at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:494)
	at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:320)
	at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)

The solution for me was to remove the vertx-config dependency (see the fixed branch). Now the fat jar runs just fine.
So my question is: Is this a bug or just something that the documentation should be more explicit about? Unfortunately I am not very familiar with ServiceLoaders and how that connects to the fat jar packaging. But I'd be glad to help out with a PR if you can point me into the right direction 👍

Thanks for the great work!

BTW: I encountered the exact same behavior on JDK 1.8 and JDK 11 (MacOs 10.14.2, Maven 3.5.4). Also changing the compilation target to 11 and upgrading the maven-shade-plugin did not change anything.

@cescoffier
Copy link
Member

It's because of the SPI combination. Either you rewrite the SPI descriptor or just use the vertx-maven-plugin that would take care of this.

@jjank
Copy link
Author

jjank commented Feb 11, 2019

Ahh, very cool I just tried it and it works perfectly fine, thanks a lot!

I generated the project via start.vertx.io which did not use this plugin...yet? There is an open issue about this: vert-x3/vertx-starter#39. Maybe I can help out with a PR there.
There is also one pending PR in the vertx-maven-starter repo: vert-x3/vertx-maven-starter#3.

Thanks anyway I'm gonna close this one now :)

@jjank jjank closed this as completed Feb 11, 2019
@toien
Copy link

toien commented Jan 22, 2021

for who use gradle shadow plugin, try this:

shadowJar{
    mergeServiceFiles()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants