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

Reactive DB connection causes problems #10982

Closed
MadinaS opened this issue Jul 27, 2020 · 33 comments
Closed

Reactive DB connection causes problems #10982

MadinaS opened this issue Jul 27, 2020 · 33 comments
Labels
kind/bug Something isn't working triage/invalid This doesn't seem right

Comments

@MadinaS
Copy link

MadinaS commented Jul 27, 2020

Hi guys! First, I want tell you all, thank you for such a great job, what do you do with Quarkus!

Describe the bug
I have 2 connections to the same DB in my applications.properties file. It's looks like this:

quarkus.datasource.jdbc=true
quarkus.datasource.db-kind=mysql
%dev.quarkus.datasource.jdbc.url=jdbc:mysql://0.0.0.0:6603/mydatabase
quarkus.datasource.driver=com.mysql.cj.jdbc.Driver
quarkus.datasource.username=username
quarkus.datasource.password=password

#and reactive connection
quarkus.datasource.reactive=true
%dev.quarkus.datasource.reactive.url=vertx-reactive:mysql://0.0.0.0:6603/mydatabase

in same file i have some property for my public key:

mp.jwt.verify.publickey.location=${share.path}/resources/publicKey.pem

${share.path} - i get from my DB, with my custom DatabaseSource.

Expected behavior
it's work fine, till i add reactive DB connection to my application.properties

Actual behavior
if i add reactive DB connection, then I get an error message, that variable ${share.path} is no longer recognized from Quarkus. It's like Quarkus don't know anymore, wich connection it should to use to get ${share.path} properties from DB.

To Reproduce
here is some simple reproducer with code from my project.

It will be nice to know, why is this so :)

@MadinaS MadinaS added the kind/bug Something isn't working label Jul 27, 2020
@gsmet
Copy link
Member

gsmet commented Jul 27, 2020

@phillip-kruger could you have a look at that one? I'm not totally sure we can make it work tbh but a closer look from you could help. Thanks!

@phillip-kruger
Copy link
Member

Hi @gsmet - I am happy to look at this. I am on PTO at the moment, but might get a gap to look at this.

@geoand geoand changed the title Reactive DB connection bringt problems Reactive DB connection causes problems Jul 27, 2020
@geoand
Copy link
Contributor

geoand commented Jul 27, 2020

So essentially you have a custom Datasource that reads from a DB which works properly until you add

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-reactive-mysql-client</artifactId>
    </dependency>

?

If so, I think this is one for @radcortez :)

@MadinaS
Copy link
Author

MadinaS commented Jul 27, 2020

So essentially you have a custom Datasource that reads from a DB which works properly until you add

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-reactive-mysql-client</artifactId>
    </dependency>

?

If so, I think this is one for @radcortez :)

yes it is. Especially until i add

quarkus.datasource.reactive=true
%dev.quarkus.datasource.reactive.url=vertx-reactive:mysql://0.0.0.0:6603/database-name
%prod.quarkus.datasource.reactive.url=vertx-reactive:mysql://${DATABASE_HOST}:${DATABASE_PORT}/database-name

to my application.properties

@geoand
Copy link
Contributor

geoand commented Jul 27, 2020

So essentially you have a custom Datasource that reads from a DB which works properly until you add

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-reactive-mysql-client</artifactId>
    </dependency>

?
If so, I think this is one for @radcortez :)

yes it is. Especially until i add

quarkus.datasource.reactive=true
%dev.quarkus.datasource.reactive.url=vertx-reactive:mysql://0.0.0.0:6603/database-name
%prod.quarkus.datasource.reactive.url=vertx-reactive:mysql://${DATABASE_HOST}:${DATABASE_PORT}/database-name

to my application.properties

Does the problem still occur if you don't use ${DATABASE_HOST} and ${DATABASE_PORT} but instead use some hard-coded value?

@MadinaS
Copy link
Author

MadinaS commented Jul 27, 2020

Does the problem still occur if you don't use ${DATABASE_HOST} and ${DATABASE_PORT} but instead use some hard-coded value?

i don't think, that it's a problem, because it also doesn't work in %dev and i use hard-coded values for my %dev

@geoand
Copy link
Contributor

geoand commented Jul 27, 2020

I just want to cover all possible bases

@radcortez
Copy link
Member

@MadinaS Was this working on any previous Quarkus version? If so, which one?

@MadinaS
Copy link
Author

MadinaS commented Jul 27, 2020

@MadinaS Was this working on any previous Quarkus version? If so, which one?

i just started with reactive DB connections, so i didn't use it before Quarkus 1.6.0

@MadinaS
Copy link
Author

MadinaS commented Jul 27, 2020

UPDATE.
here is my error message:

2020-07-27 12:30:22,120 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-2) HTTP Request to /konto-service/api/auth/login failed, error id: 258c5184-d79a-4dd4-9a88-53e65bbcf9cb-3: java.lang.RuntimeException: Error injecting java.util.Optional<java.lang.String> io.smallrye.jwt.config.JWTAuthContextInfoProvider.mpJwtLocation
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_Bean.create(JWTAuthContextInfoProvider_Bean.zig:3213)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_Bean.get(JWTAuthContextInfoProvider_Bean.zig:3734)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_Bean.get(JWTAuthContextInfoProvider_Bean.zig:3769)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_Bean.create(JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_Bean.zig:162)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_Bean.create(JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_Bean.zig:205)
        at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:88)
        at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
        at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
        at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
        at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_ClientProxy.arc$delegate(JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_ClientProxy.zig:92)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_ClientProxy.getTokenHeader(JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_ClientProxy.zig:903)
        at io.quarkus.smallrye.jwt.runtime.auth.JWTAuthMechanism.getCredentialTransport(JWTAuthMechanism.java:107)
        at io.quarkus.smallrye.jwt.runtime.auth.JWTAuthMechanism_ClientProxy.getCredentialTransport(JWTAuthMechanism_ClientProxy.zig:154)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator.<init>(HttpAuthenticator.java:70)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_Bean.create(HttpAuthenticator_Bean.zig:401)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_Bean.create(HttpAuthenticator_Bean.zig:461)
        at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:88)
        at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
        at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
        at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
        at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_ClientProxy.arc$delegate(HttpAuthenticator_ClientProxy.zig:92)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_ClientProxy.attemptAuthentication(HttpAuthenticator_ClientProxy.zig:182)
        at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:97)
        at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:49)
        at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1034)
        at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:131)
        at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133)
        at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:74)
        at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:63)
        at io.vertx.core.impl.ContextImpl.lambda$null$0(ContextImpl.java:327)
        at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366)
        at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.NoSuchElementException: SRCFG00011: Could not expand value share.path in property mp.jwt.verify.publickey.location
        at io.smallrye.config.ExpressionConfigSourceInterceptor.lambda$getValue$0(ExpressionConfigSourceInterceptor.java:44)
        at io.smallrye.common.expression.ExpressionNode.emit(ExpressionNode.java:22)
        at io.smallrye.common.expression.CompositeNode.emit(CompositeNode.java:22)
        at io.smallrye.common.expression.Expression.evaluateException(Expression.java:56)
        at io.smallrye.common.expression.Expression.evaluate(Expression.java:70)
        at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:37)
        at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:18)
        at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
        at io.smallrye.config.ProfileConfigSourceInterceptor.getValue(ProfileConfigSourceInterceptor.java:60)
        at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
        at io.quarkus.runtime.configuration.QuarkusProfileConfigSourceInterceptor.getValue(QuarkusProfileConfigSourceInterceptor.java:25)
        at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
        at io.smallrye.config.SmallRyeConfig.getConfigValue(SmallRyeConfig.java:180)
        at io.smallrye.config.SmallRyeConfig.getRawValue(SmallRyeConfig.java:191)
        at io.smallrye.config.inject.ConfigProducerUtil.lambda$getRawValue$0(ConfigProducerUtil.java:79)
        at io.smallrye.config.SecretKeys.doUnlocked(SecretKeys.java:28)
        at io.smallrye.config.inject.ConfigProducerUtil.getRawValue(ConfigProducerUtil.java:79)
        at io.smallrye.config.inject.ConfigProducerUtil.getValue(ConfigProducerUtil.java:43)
        at io.smallrye.config.inject.ConfigProducer.produceOptionalConfigValue(ConfigProducer.java:117)
        at io.smallrye.config.inject.ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.create(ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.zig:248)
        at io.smallrye.config.inject.ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.get(ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.zig:278)
        at io.smallrye.config.inject.ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.get(ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.zig:313)
        at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:52)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_Bean.create(JWTAuthContextInfoProvider_Bean.zig:3195)
        ... 40 more

@radcortez
Copy link
Member

Ok, let me have a look.

@radcortez
Copy link
Member

Hi @MadinaS,

Unfortunately, I was not able to move that much with your reproducer. There are a few things that are missing:

  • The application.properties file is in the wrong place.
  • The DatabaseConfigSource is not properly registered with a META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource file.
  • I do require to set up a MySQL database and proper schemas to try out the project. Can you provide a docker-compose file with the required infra, or maybe move the database to use H2 for the reproducer?

Are you able to fix the above issues? Thank you!

@MadinaS
Copy link
Author

MadinaS commented Jul 27, 2020

Hi @MadinaS,

Unfortunately, I was not able to move that much with your reproducer. There are a few things that are missing:

* The `application.properties` file is in the wrong place.

* The `DatabaseConfigSource` is not properly registered with a `META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource` file.

* I do require to set up a MySQL database and proper schemas to try out the project. Can you provide a `docker-compose` file with the required infra, or maybe move the database to use H2 for the reproducer?

Are you able to fix the above issues? Thank you!

sorry, just weird commit Oo have already fixed
now it must be okay. I have built some mysql container for my project. U can use it from docker push madinas/kniffel-mysql
i'm not sure, am i can so fast make some h2 DB reproducer, but i can add some .sql file to my repo, than u can create the same DB based on my .sql and docker image

@radcortez
Copy link
Member

Ok, let me check

@radcortez
Copy link
Member

Hi @MadinaS I had a look and everything since to work fine.

After a few changes to your code, I was able to retrieve the expansion variable from the database using the Config.

Are you sure that you have share.path available in your Database? Can you try adding it to the application.properties file so we are sure that it works? Thanks!

@MadinaS
Copy link
Author

MadinaS commented Jul 27, 2020

Hi @MadinaS I had a look and everything since to work fine.

After a few changes to your code, I was able to retrieve the expansion variable from the database using the Config.

Are you sure that you have share.path available in your Database? Can you try adding it to the application.properties file so we are sure that it works? Thanks!

yes, i'm sure, that i have this share.path in my database... and u can see this property at line 4 and 5 in my application.properties
because of

mp.jwt.verify.publickey.location=${share.path}/resources/publicKey.pem

not working now, i commented that line and added it that to DB like full path:

#in DB:
mp.jwt.verify.publickey.location = /kniffelSharedVolume/resources/publicKey.pem

my app (with reactive DB inside) have no problem, if some property will be saved in DB... but only if it will be saved complete and not partial...

@MadinaS
Copy link
Author

MadinaS commented Jul 27, 2020

@radcortez ach, i know.... i can also start app without errors... first, wen i use my login and mp.jwt.verify.publickey.location will be called - i became error message

@radcortez
Copy link
Member

I've pushed a PR to your repro project:
MadinaS/quarkusReactuvePlusConfigSource#1

You notice that I've implemented a test that retrieves that configuration. Assuming that you have a MySQL DB running on the test profile that I've added (same as dev), it should work. I did create the schema and populated the table manually on a local docker MySQL instance.

@MadinaS
Copy link
Author

MadinaS commented Jul 30, 2020

I've pushed a PR to your repro project:
MadinaS/quarkusReactuvePlusConfigSource#1

You notice that I've implemented a test that retrieves that configuration. Assuming that you have a MySQL DB running on the test profile that I've added (same as dev), it should work. I did create the schema and populated the table manually on a local docker MySQL instance.

sorry, i didn't answered several days. Soo i used u TestClass and It also works perfectly for me. However, when I start my application and try to login, it no longer works. Moment, I am preparing an example with my login class.

@MadinaS
Copy link
Author

MadinaS commented Jul 30, 2020

I've pushed a PR to your repro project:
MadinaS/quarkusReactuvePlusConfigSource#1

You notice that I've implemented a test that retrieves that configuration. Assuming that you have a MySQL DB running on the test profile that I've added (same as dev), it should work. I did create the schema and populated the table manually on a local docker MySQL instance.

i added another Tests for my REST point... tetst work fine, but i still have Error, wenn i try to login in my app

Screenshot from 2020-07-30 17-34-48

2020-07-30 17:23:29,925 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-3) HTTP Request to /konto-service/api/auth/login failed, error id: 47b9a0b7-4a48-4a68-9471-f11a696ba40e-2: java.lang.RuntimeException: Error injecting java.util.Optional<java.lang.String> io.smallrye.jwt.config.JWTAuthContextInfoProvider.mpJwtLocation
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_Bean.create(JWTAuthContextInfoProvider_Bean.zig:3213)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_Bean.get(JWTAuthContextInfoProvider_Bean.zig:3734)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_Bean.get(JWTAuthContextInfoProvider_Bean.zig:3769)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_Bean.create(JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_Bean.zig:162)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_Bean.create(JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_Bean.zig:205)
        at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:88)
        at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
        at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
        at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
        at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_ClientProxy.arc$delegate(JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_ClientProxy.zig:92)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_ClientProxy.getTokenHeader(JWTAuthContextInfoProvider_ProducerMethod_getContextInfo_21d111677ae04ef1a7cf911100af3482e4c3b30a_ClientProxy.zig:903)
        at io.quarkus.smallrye.jwt.runtime.auth.JWTAuthMechanism.getCredentialTransport(JWTAuthMechanism.java:107)
        at io.quarkus.smallrye.jwt.runtime.auth.JWTAuthMechanism_ClientProxy.getCredentialTransport(JWTAuthMechanism_ClientProxy.zig:154)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator.<init>(HttpAuthenticator.java:70)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_Bean.create(HttpAuthenticator_Bean.zig:401)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_Bean.create(HttpAuthenticator_Bean.zig:461)
        at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:88)
        at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
        at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
        at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
        at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_ClientProxy.arc$delegate(HttpAuthenticator_ClientProxy.zig:92)
        at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_ClientProxy.attemptAuthentication(HttpAuthenticator_ClientProxy.zig:182)
        at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:97)
        at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:49)
        at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1034)
        at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:131)
        at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133)
        at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:74)
        at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:63)
        at io.vertx.core.impl.ContextImpl.lambda$null$0(ContextImpl.java:327)
        at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366)
        at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.NoSuchElementException: SRCFG00011: Could not expand value share.path in property mp.jwt.verify.publickey.location
        at io.smallrye.config.ExpressionConfigSourceInterceptor.lambda$getValue$0(ExpressionConfigSourceInterceptor.java:44)
        at io.smallrye.common.expression.ExpressionNode.emit(ExpressionNode.java:22)
        at io.smallrye.common.expression.CompositeNode.emit(CompositeNode.java:22)
        at io.smallrye.common.expression.Expression.evaluateException(Expression.java:56)
        at io.smallrye.common.expression.Expression.evaluate(Expression.java:70)
        at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:37)
        at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:18)
        at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
        at io.smallrye.config.ProfileConfigSourceInterceptor.getValue(ProfileConfigSourceInterceptor.java:60)
        at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
        at io.quarkus.runtime.configuration.QuarkusProfileConfigSourceInterceptor.getValue(QuarkusProfileConfigSourceInterceptor.java:25)
        at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
        at io.smallrye.config.SmallRyeConfig.getConfigValue(SmallRyeConfig.java:180)
        at io.smallrye.config.SmallRyeConfig.getRawValue(SmallRyeConfig.java:191)
        at io.smallrye.config.inject.ConfigProducerUtil.lambda$getRawValue$0(ConfigProducerUtil.java:79)
        at io.smallrye.config.SecretKeys.doUnlocked(SecretKeys.java:28)
        at io.smallrye.config.inject.ConfigProducerUtil.getRawValue(ConfigProducerUtil.java:79)
        at io.smallrye.config.inject.ConfigProducerUtil.getValue(ConfigProducerUtil.java:43)
        at io.smallrye.config.inject.ConfigProducer.produceOptionalConfigValue(ConfigProducer.java:117)
        at io.smallrye.config.inject.ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.create(ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.zig:248)
        at io.smallrye.config.inject.ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.get(ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.zig:278)
        at io.smallrye.config.inject.ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.get(ConfigProducer_ProducerMethod_produceOptionalConfigValue_ee0d6f41f2179c75c97fd458cb497ef0c9c8c9de_Bean.zig:313)
        at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:52)
        at io.smallrye.jwt.config.JWTAuthContextInfoProvider_Bean.create(JWTAuthContextInfoProvider_Bean.zig:3195)
        ... 40 more

@radcortez
Copy link
Member

Hi @MadinaS

Can you do a lookup on the share.path directly with ConfigProvider.getConfig().getValue("share.path", String.class); and check the output on both tests and dev mode? Thanks!

@MadinaS
Copy link
Author

MadinaS commented Jul 30, 2020

Hi @MadinaS

Can you do a lookup on the share.path directly with ConfigProvider.getConfig().getValue("share.path", String.class); and check the output on both tests and dev mode? Thanks!

i have tested it and my GH-app gives me correct value (dev and test)... but my work Projekt can't now respond to any REST requests, because of this jwt property error.... but I can not find any differences between my work-project and GH -project .. no idea, what can it be ...

@MadinaS
Copy link
Author

MadinaS commented Jul 31, 2020

@radcortez
if i disable my quarkus.smallrye-jwt.enabled=true in application.properties - then there are no more error messages.

@radcortez
Copy link
Member

Hum, maybe there is an issue with SmallRye JWT. Let me give it a try.

@radcortez
Copy link
Member

Hum, seems to be fine as well.

So, things do work on the GH project, but not in your real project?

@MadinaS
Copy link
Author

MadinaS commented Jul 31, 2020

Hum, seems to be fine as well.

So, things do work on the GH project, but not in your real project?

Exact... I think, I need to look deeper in my project, which dependencies i have with SmallRye or why it can‘t be used with reactive DB.. but I will have next week time for this. I will write here later, will also try to copy more important classes from my project to GH, maybe than u can see more and why it don’t work together...anyway, thank u for u time and help! :)

@radcortez
Copy link
Member

Ok, I'm sorry I couldn't help you further. Please, let me know when you have more information and I'll be happy to continue.

@MadinaS
Copy link
Author

MadinaS commented Aug 3, 2020

Ok, I'm sorry I couldn't help you further. Please, let me know when you have more information and I'll be happy to continue.

new week - new challenges! =) can u try send a request to a StatisticSocket? I think, it's not a problem of reactive DB connection, but of connection to WebSocket... it's not important (in my GH app) which ¸{chatKey} do u use, just make request to [host]:[port]/sync/[some-key-or-just-text]... if u steel have no error - i will upload extended version of test-app on GH.

@MadinaS
Copy link
Author

MadinaS commented Aug 3, 2020

@radcortez i think, mp.jwt.verify.publickey.location just don't understand ${share.path} injection, if it not from application.properties, but from custom ConfigSource... in my real project even this:

%prod.share.path=/sharedVolume
%dev.share.path=/bla-bla/shared-volume
%test.share.path=/bla-bla/shared-volume
mp.jwt.verify.publickey.location=${share.path}/resources/publicKey.pem

throw an error.

@radcortez
Copy link
Member

Hi @MadinaS, I've added a PR to your repro project:
MadinaS/quarkusReactuvePlusConfigSource#2

This injects both the SmallRye JWT JWTAuthContextInfoProvider which is used to perform the authentication and the mp.jwt.verify.publickey.location property directly. Both of them work, using your custom ConfigSource.

There must be some sort of condition in your real project that may be preventing the expansion of the variable. We need to find a way to reproduce this same behaviour in your demo project. Are you able to do it? Thanks!

@MadinaS
Copy link
Author

MadinaS commented Aug 3, 2020

Hi @radcortez

i added u to my private repository. In this repository, tests not working, but i can't find difference between real-project (private repo) and example-project (first repo) and understand why it don't see my ${share.path}. There is a little bit more code, maybe u will see, what i can't..

@radcortez
Copy link
Member

Ok, let me try it.

@radcortez
Copy link
Member

Hi @MadinaS,

The issue you were facing is the same reported here: #10570. Updating to Quarkus 1.6.1 should fix your issue.

I've tested it in your second repro project and it does work. For now, I'm closing the issue. Please, let me know if you need anything else.

@geoand geoand added the triage/invalid This doesn't seem right label Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

5 participants