我第一次尝试使用qbit (https://github.com/advantageous/qbit),我必须手动处理所有依赖项(不能使用maven等)。
我得到了以下例外:
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.base/java.lang.J9VMInternals.ensureError(J9VMInternals.java:186)
at java.base/java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:175)
at io.advantageous.boon.core.reflection.Reflection.<clinit>(Reflection.java:114)
at io.advantageous.boon.core.reflection.ClassMeta.classMeta(ClassMeta.java:271)
at io.advantageous.qbit.QBit.registerReflectionAndJsonParser(QBit.java:68)
at io.advantageous.qbit.QBit.doGetFactory(QBit.java:57)
at io.advantageous.qbit.QBit.factory(QBit.java:45)
at io.advantageous.qbit.http.server.HttpServerBuilder.getFactory(HttpServerBuilder.java:136)
at io.advantageous.qbit.http.server.HttpServerBuilder.build(HttpServerBuilder.java:236)
at com.myapp.main(App.java:92)
Caused by: java.lang.ClassCastException: [B incompatible with [C
at
io.advantageous.boon.core.reflection.FastStringUtils$StringImplementation$1.toCharArray (FastStringUtils.java:93)
at io.advantageous.boon.core.reflection.FastStringUtils.toCharArray(FastStringUtils.java:178)
at io.advantageous.boon.core.Str.underBarCase(Str.java:538)
at io.advantageous.boon.core.Sys.sysProp(Sys.java:329)
at io.advantageous.boon.core.timer.TimeKeeperBasic.<init>(TimeKeeperBasic.java:52)
at io.advantageous.boon.core.Sys.<clinit>(Sys.java:171)
... 9 more到目前为止,我添加的jar文件是依赖关系:
我还尝试添加以下内容,根据maven,这似乎是依赖关系,但没有成功:
此外,我的项目使用:
有人能告诉我我错过了什么吗?qbit的maven链接是:https://search.maven.org/search?q=io.advantageous.qbit
发布于 2020-10-30 18:26:38
问题是,您正在使用的是Java9+,而且还没有更新9+的福利依赖关系。这个库中的FastStringUtils类为访问String类的内部字段做了一些反思,但是String的内部字段在Java9中发生了变化。
由于这个问题,这个GitHub问题于2015年11月开通,但几乎五年后仍在运营。
解决方法要么是在Java8中运行应用程序,要么是在系统属性io.advantageous.boon.faststringutils.disable设置为true的情况下运行您的项目。可以通过添加命令行参数-Dio.advantageous.boon.faststringutils.disable=true或添加行来做到这一点。
System.setProperty("io.advantageous.boon.faststringutils.disable", "true");App类的main方法,在调用堆栈跟踪中显示的build()方法之前。
https://stackoverflow.com/questions/64611717
复制相似问题