首页 > 编程语言 >Caused by: java.lang.NoClassDefFoundError: net/minidev/asm/FieldFilter 报错的解决

Caused by: java.lang.NoClassDefFoundError: net/minidev/asm/FieldFilter 报错的解决

时间:2022-11-09 17:01:10浏览次数:50  
标签:lang java support factory springframework 报错 org beans

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Factory method 'requestMappingHandlerAdapter' threw exception; nested exception is java.lang.NoClassDefFoundError: net/minidev/asm/FieldFilter
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:635)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
	... 63 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Factory method 'requestMappingHandlerAdapter' threw exception; nested exception is java.lang.NoClassDefFoundError: net/minidev/asm/FieldFilter
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650)
	... 82 more
Caused by: java.lang.NoClassDefFoundError: net/minidev/asm/FieldFilter
	at net.minidev.json.reader.JsonWriter.<clinit>(JsonWriter.java:157)
	at net.minidev.json.JSONValue.<clinit>(JSONValue.java:527)
	at com.jayway.jsonpath.spi.json.JsonSmartJsonProvider.<init>(JsonSmartJsonProvider.java:39)
	at com.jayway.jsonpath.internal.DefaultsImpl.jsonProvider(DefaultsImpl.java:21)
	at com.jayway.jsonpath.Configuration$ConfigurationBuilder.build(Configuration.java:231)
	at org.springframework.data.web.JsonProjectingMethodInterceptorFactory.<init>(JsonProjectingMethodInterceptorFactory.java:75)
	at org.springframework.data.web.ProjectingJackson2HttpMessageConverter.initProjectionFactory(ProjectingJackson2HttpMessageConverter.java:87)
	at org.springframework.data.web.ProjectingJackson2HttpMessageConverter.<init>(ProjectingJackson2HttpMessageConverter.java:72)
	at org.springframework.data.web.config.SpringDataWebConfiguration.extendMessageConverters(SpringDataWebConfiguration.java:162)
	at org.springframework.web.servlet.config.annotation.WebMvcConfigurerComposite.extendMessageConverters(WebMvcConfigurerComposite.java:144)
	at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration.extendMessageConverters(DelegatingWebMvcConfiguration.java:123)
	at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.getMessageConverters(WebMvcConfigurationSupport.java:813)
	at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.requestMappingHandlerAdapter(WebMvcConfigurationSupport.java:615)
	at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.requestMappingHandlerAdapter(WebMvcAutoConfiguration.java:386)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	... 83 more
Caused by: java.lang.ClassNotFoundException: net.minidev.asm.FieldFilter
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 102 more

  

Spring Boot 在 Windows 运行单元测试报错

方法一:

发现json-smart-2.3.jar引起了报错,使用 Maven Helper 插件在 pom 中搜索这个 jar , 把这个 jar 排除掉,重新导入一下 pom, 再次运行单元测试,发现问题解决

 

 

 

 如果解决不了请看方法二

方法二:

在第一和第二标注的行之间加入代码

<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<artifactId>json-path</artifactId>
					<groupId>com.jayway.jsonpath</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>

  

 

 

 手动添加

标签:lang,java,support,factory,springframework,报错,org,beans
From: https://www.cnblogs.com/luorongxin/p/16874353.html

相关文章

  • JavaScript 清空对象的值
      functionclearObj(obj){//判断是不是对象if(!Object.prototype.toString.call(obj)=="[objectObject]"){returnfalse;}for(constkey......
  • javascript基础知识之多维数组扁平化去重排序
    vararr=[1,2,3,4,5,[1,2,6,8]]=>[1,2,3,4,5,6,8]vararr=[1,2,3,4,5,[1,2,6,8]]//js方法实现varflatArr=arr.toString().split(",")//扁平functionun......
  • 2022 年你需要掌握的 7 种关于 JavaScript 的数组方法(下)
    4.Array.forEach()现在这是一个经典。那个 forEach() 方法的工作原理很像常规 for 循环。它在数组上循环并对每个项目执行一个函数。 .forEach() 的第一个参数是......
  • javascript基础知识之闭包和递归
    一,什么是闭包,会出现什么问题?如何避免?1、函数里面包含的子函数,子函数访问父函数的局部变量2、通过return将子函数暴露在全局作用域,子函数就形成闭包3、通过闭包,父函数的局......
  • mysql mysqldump常见报错
    目录mysqlmysqldump常见报错ERROR2006(HY000)atline5922:MySQLserverhasgoneawaymysqlmysqldump常见报错ERROR2006(HY000)atline5922:MySQLserverha......
  • Kafka Java客户端Stream API
    KafkaStream概念及初识高层架构图KafkaStream是ApacheKafka从0.10版本引入的一个新Feature,它提供了对存储于Kafka内的数据进行流式处理和分析的功能。简而言之,KafkaStre......
  • ElasticSearch Java API之索引操作
    背景:​​ElasticSearchJava客户端连接ElasticSearch​​以这篇博客为基础​​ElasticSearch:简单介绍以及使用Docker部署ElasticSearch和Kibana​​这篇博客简单部署了E......
  • ElasticSearch Java API之文档操作
    文档Document简单介绍被索引的一条数据,索引的基本信息单元,以JSON格式来表示。比如:你可以拥有某一个客户的文档,某一个产品的一个文档,当然,也可以拥有某个订单的一个文档。文档......
  • ElasticSearch Java 客户端连接ElasticSearch
    背景:​​ElasticSearch:简单介绍以及使用Docker部署ElasticSearch和Kibana​​这篇博客简单部署了ElasticSearchElasticSearch客户端特征所有ElasticsearchAPI的强类......
  • kafka Java客户端之 consumer API 消费消息
    背景:我使用docker-compose搭建的kafka服务​kafka的简单介绍以及docker-compose部署单主机Kafka集群​​使用consumerAPI消费指定Topic里面的消息首先我们需要使用AdminA......