讨论区 » AAS-V10企业版 »
jackson类冲突:Caused by: java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule not a subtype
异常信息:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceDirectoryRemoteService' defined in class path resource [com/xxxxx/yyyy/core/openfeign/autoconfigure/RemoteServiceAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxxx.yyyy.core.remote.servicedirectory.ServiceDirectoryService]: Factory method 'serviceDirectoryRemoteService' threw exception; nested exception is java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule not a subtype
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
... 108 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxxx.yyyy.core.remote.servicedirectory.ServiceDirectoryService]: Factory method 'serviceDirectoryRemoteService' threw exception; nested exception is java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule not a subtype
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 122 common frames omitted
Caused by: java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule not a subtype
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:589)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1237)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1265)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1300)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1385)
at com.fasterxml.jackson.databind.ObjectMapper.findModules(ObjectMapper.java:1131)
at com.fasterxml.jackson.databind.ObjectMapper.findModules(ObjectMapper.java:1115)
at com.fasterxml.jackson.databind.ObjectMapper.findAndRegisterModules(ObjectMapper.java:1165)
at com.xxxx.yyyy.core.common.util.ObjectMapper$ObjectMapperFactory.create(ObjectMapper.java:209)
at com.xxxx.yyyy.core.openfeign.codec.encoder.JacksonEncoder.<init>(JacksonEncoder.java:34)
at com.xxxx.yyyy.core.openfeign.FeignFactory.create(FeignFactory.java:90)
at com.xxxx.yyyy.core.openfeign.autoconfigure.RemoteServiceAutoConfiguration.serviceDirectoryRemoteService(RemoteServiceAutoConfiguration.java:70)
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 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 123 common frames omitted
处理方案:添加相关apusic-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<aas-web-app error-url="">
<class-loader delegate="false">
<property name="ignoreParentsFiles" value="true"></property>
<property name="ignoreClassPrefix" value="com.fasterxml.jackson"></property>
<property name="ignoreResources" value="META-INF/services/com.fasterxml.jackson.databind.Module"></property>
</class-loader>
</aas-web-app>
apusic-web.xml (382 Bytes) apusic-web.xml |