Quarkus K8S操作器-运行测试时NoSuchField异常



当我使用quarkus操作符运行K8S操作符的测试时,我得到以下堆栈跟踪:

2021-10-29 18:14:08,668 WARN  [io.qua.ope.dep.OperatorSDKProcessor] (build-33) Use of deprecated check-crd-and-validate-local-model property. Use crd.validate instead.
java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkiverse.operatorsdk.deployment.OperatorSDKProcessor#createConfigurationServiceAndOperator threw an exception: java.lang.NoSuchFieldError: _visitables
at io.sundr.model.ClassRefFluentImpl.withArguments(ClassRefFluentImpl.java:318)
at io.sundr.adapter.reflect.TypeToTypeRef.apply(TypeToTypeRef.java:114)
at io.sundr.adapter.reflect.TypeToTypeRef.apply(TypeToTypeRef.java:76)
at io.sundr.adapter.reflect.TypeToTypeRef.apply(TypeToTypeRef.java:41)
at io.sundr.adapter.reflect.ClassToTypeDef.apply(ClassToTypeDef.java:92)
at io.sundr.adapter.reflect.ClassToTypeDef.apply(ClassToTypeDef.java:55)
at io.sundr.adapter.api.Adapter.adaptType(Adapter.java:38)
at io.sundr.adapter.api.Adapters.lambda$adaptType$0(Adapters.java:35)
at java.base/java.util.Optional.map(Optional.java:265)
at io.sundr.adapter.api.Adapters.adaptType(Adapters.java:35)
at io.fabric8.crd.generator.utils.Types.typeDefFrom(Types.java:53)
at io.fabric8.crd.generator.CustomResourceInfo.fromClass(CustomResourceInfo.java:137)
at io.quarkiverse.operatorsdk.deployment.OperatorSDKProcessor.createControllerConfiguration(OperatorSDKProcessor.java:281)
at io.quarkiverse.operatorsdk.deployment.OperatorSDKProcessor.lambda$createConfigurationServiceAndOperator$0(OperatorSDKProcessor.java:133)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1603)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at io.quarkiverse.operatorsdk.deployment.OperatorSDKProcessor.createConfigurationServiceAndOperator(OperatorSDKProcessor.java:137)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
...

我真的不知道该去哪里解决这个问题。

当我单独运行操作符时,它正常工作,只有在运行测试时才会出现问题。

看起来您正在使用的fabric8客户端版本太旧了。您使用的是fabric8 5.3.0,而quarkus-operator-sdk版本1.9.4使用的是fabric8 5.4.0。使用相同的fabric8客户端版本应该可以解决您的问题。

问题来自我的maven版本:我在v3.6.3中使用与IDE捆绑的mvn,而不是我在整个系统v3.8.1中使用的mvn。

这里非常奇怪的事情是,我有同样的错误,而从终端运行mvn clean install(所以使用v3.8.1版本)

不管怎样,它现在工作了。

相关内容

  • 没有找到相关文章

最新更新