gpt4 book ai didi

grails cxf BeanCreationException

转载 作者:行者123 更新时间:2023-12-02 15:05:40 27 4
gpt4 key购买 nike

我正在使用 grails cxf-Plugin,它在本地运行良好,但是当我将它部署在 tomcat 服务器上时出现错误:

ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creating bean with name 'cxf': 
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]:
Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.
... 5 more
Caused by: org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.
at org.apache.cxf.bus.extension.Extension.tryClass(Extension.java:183)
at org.apache.cxf.bus.extension.Extension.getClassObject(Extension.java:199)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.activateAllByType(ExtensionManagerImpl.java:144)
at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:180)
at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:192)
at org.apache.cxf.bus.spring.SpringBus.<init>(SpringBus.java:45)
... 5 more
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.cxf.bus.extension.Extension.tryClass(Extension.java:164)
... 10 more

这是我的 BuildConfig 的一个片段:
    compile ":ws-client:1.0"
compile ":cxf-client:2.1.1"
compile ":cxf:2.1.1"

我用 grails war 建立一个 war 文件并将其部署在 Tomcat 服务器上
我检查了 WEB-INF/lib Tomcat服务器上项目的文件夹,并且有jar:
cxf-bundle-2.2.4.jar
cxf-core-3.0.4.jar
cxf-rt-bindings-soap-3.0.4.jar
cxf-rt-bindings-xml-3.0.4.jar
cxf-rt-databinding-jaxb-3.0.4.jar
cxf-rt-frontend-jaxrs-3.0.4.jar
cxf-rt-frontend-jaxws-3.0.4.jar
cxf-rt-frontend-simple-3.0.4.jar
cxf-rt-security-3.0.4.jar
cxf-rt-transports-http-3.0.4.jar
cxf-rt-ws-addr-3.0.4.jar
cxf-rt-wsdl-3.0.4.jar
cxf-rt-ws-policy-3.0.4.jar
cxf-rt-ws-security-3.0.4.jar
cxf-tools-common-3.0.4.jar
cxf-tools-validator-3.0.4.jar
cxf-tools-wsdlto-core-3.0.4.jar
cxf-tools-wsdlto-databinding-jaxb-3.0.4.jar
cxf-tools-wsdlto-frontend-jaxws-3.0.4.jar

为什么我在 Tomcat 服务器上收到此错误?

最佳答案

我有同样的问题,我花了相当长的时间来解决这个问题。也有人在 SO 上发布了这个问题:

cxf-failing-with-incompatibleclasschangeerror-exception-on-unit-test

could-not-load-extension-class-org-apache-cxf-ws-policy-assertionbuilderregistry

AssertionBuilderRegistry 加载失败,因为它是一个接口(interface)并且扩展了 AssertionBuilderFactory,而在旧版本的 neethi 库中,AssertionBuilderFactory 被定义为一个具体类。因此引发了 IncompatibleClassChangeError。

关于 IncompatibleClassChangeError 的原因:

what-causes-java-lang-incompatibleclasschangeerror

总之,您需要升级 neethi 库版本。

关于grails cxf BeanCreationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32777658/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com