首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >qbit福利反映ClassCastException:[B与[C ]不兼容

qbit福利反映ClassCastException:[B与[C ]不兼容
EN

Stack Overflow用户
提问于 2020-10-30 15:55:55
回答 1查看 101关注 0票数 0

我第一次尝试使用qbit (https://github.com/advantageous/qbit),我必须手动处理所有依赖项(不能使用maven等)。

我得到了以下例外:

代码语言:javascript
复制
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文件是依赖关系:

  • qbit-core-2.0.0.jar
  • qbit-web-0.8.18.jar --我也尝试过不包括这个,但无论是哪种方式,似乎都没有什么区别。
  • boon-reflekt-0.6.6.jar

我还尝试添加以下内容,根据maven,这似乎是依赖关系,但没有成功:

  • reactive-streams-1.0.0.jar
  • boon-json-0.6.6.jar
  • metrik-0.1.0.jar
  • slf4j-api-1.7.30.jar

此外,我的项目使用:

  • curator-recipes-4.2.0.jar
  • curator-x-discovery-4.2.0.jar
  • org.json.jar (不确定我有哪个版本,但罐子是从2017年9月18日开始的)

有人能告诉我我错过了什么吗?qbit的maven链接是:https://search.maven.org/search?q=io.advantageous.qbit

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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或添加行来做到这一点。

代码语言:javascript
复制
System.setProperty("io.advantageous.boon.faststringutils.disable", "true");

App类的main方法,在调用堆栈跟踪中显示的build()方法之前。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64611717

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档