'
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap')
at io.vertx.core.json.JsonObject.getLong(JsonObject.java:493)
at io.vertx.core.json.JsonObject.getLong(JsonObject.java:757)
at io.vertx.ext.auth.User.expired(User.java:168)
at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.authenticate(JWTAuthProviderImpl.java:184)
at io.vertx.ext.auth.authentication.AuthenticationProvider.authenticate(AuthenticationProvider.java:109)
at io.vertx.rxjava3.ext.auth.authentication.AuthenticationProvider.lambda$rxAuthenticate$6(AuthenticationProvider.java:172)
at io.vertx.rxjava3.impl.AsyncResultSingle.subscribeActual(AsyncResultSingle.java:56)
at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4799)
at cn.mok.vertxdemo.router.UserVerticle.lambda$5(UserVerticle.java:61)
at io.reactivex.rxjava3.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:62)
at io.vertx.rxjava3.impl.AsyncResultSingle.lambda$subscribeActual$0(AsyncResultSingle.java:60)
at io.vertx.lang.rx.DelegatingHandler.handle(DelegatingHandler.java:20)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:86)
at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:163)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:51)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.core.Promise.complete(Promise.java:66)
at io.vertx.core.eventbus.impl.ReplyHandler.dispatch(ReplyHandler.java:97)
at io.vertx.core.eventbus.impl.HandlerRegistration$InboundDeliveryContext.execute(HandlerRegistration.java:137)
at io.vertx.core.eventbus.impl.DeliveryContextBase.next(DeliveryContextBase.java:72)
at io.vertx.core.eventbus.impl.DeliveryContextBase.dispatch(DeliveryContextBase.java:43)
at io.vertx.core.eventbus.impl.HandlerRegistration.dispatch(HandlerRegistration.java:98)
at io.vertx.core.eventbus.impl.ReplyHandler.doReceive(ReplyHandler.java:81)
at io.vertx.core.eventbus.impl.HandlerRegistration.lambda$receive$0(HandlerRegistration.java:49)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
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:833)
Token is invalid. Error: class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap')
'
Questions
vertx rxjava3 vertx-jwt-auth rxAuthenticate Exception
Version
vertx 4.4.4 rxjava3
pom.xml ` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
`
Context
` generateToken
JsonObject tokenData = new JsonObject() .put("userId", u.getId()).put("username", username) .put("nickname", u.getNickName()) .put("iat", Long.valueOf(System.currentTimeMillis() / 1000)) .put("exp", Long.valueOf((System.currentTimeMillis() + 3600) / 1000)); msg.reply(Jwt.getAuth().generateToken(tokenData));
rxAuthenticate
Jwt.getAuth().rxAuthenticate(new TokenCredentials(res.body().toString())) .subscribe(user -> { System.out.println("Token is valid. User: " + user.principal().getString("sub")); }, error -> { error.printStackTrace(); System.out.println("Token is invalid. Error: " + error.getMessage()); }); `
Do you have a reproducer?
' java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap') at io.vertx.core.json.JsonObject.getLong(JsonObject.java:493) at io.vertx.core.json.JsonObject.getLong(JsonObject.java:757) at io.vertx.ext.auth.User.expired(User.java:168) at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.authenticate(JWTAuthProviderImpl.java:184) at io.vertx.ext.auth.authentication.AuthenticationProvider.authenticate(AuthenticationProvider.java:109) at io.vertx.rxjava3.ext.auth.authentication.AuthenticationProvider.lambda$rxAuthenticate$6(AuthenticationProvider.java:172) at io.vertx.rxjava3.impl.AsyncResultSingle.subscribeActual(AsyncResultSingle.java:56) at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813) at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4799) at cn.mok.vertxdemo.router.UserVerticle.lambda$5(UserVerticle.java:61) at io.reactivex.rxjava3.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:62) at io.vertx.rxjava3.impl.AsyncResultSingle.lambda$subscribeActual$0(AsyncResultSingle.java:60) at io.vertx.lang.rx.DelegatingHandler.handle(DelegatingHandler.java:20) at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141) at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54) at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:86) at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:163) at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:51) at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211) at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23) at io.vertx.core.Promise.complete(Promise.java:66) at io.vertx.core.eventbus.impl.ReplyHandler.dispatch(ReplyHandler.java:97) at io.vertx.core.eventbus.impl.HandlerRegistration$InboundDeliveryContext.execute(HandlerRegistration.java:137) at io.vertx.core.eventbus.impl.DeliveryContextBase.next(DeliveryContextBase.java:72) at io.vertx.core.eventbus.impl.DeliveryContextBase.dispatch(DeliveryContextBase.java:43) at io.vertx.core.eventbus.impl.HandlerRegistration.dispatch(HandlerRegistration.java:98) at io.vertx.core.eventbus.impl.ReplyHandler.doReceive(ReplyHandler.java:81) at io.vertx.core.eventbus.impl.HandlerRegistration.lambda$receive$0(HandlerRegistration.java:49) at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) 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:833) Token is invalid. Error: class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap') '
Extra