The type org.springframework.context.ConfigurableApplicationContext cannot be resolved

在main中的run方法报出异常,“The project was not built since its build path is incomplete. Cannot find the class file for org.springframework.context.ConfigurableApplicationContext. Fix the build path then try building this project ” project前有小红叹号,但是在 java Build Path中并没有出现任何异常。 
在markers view 中提示:“The type org.springframework.context.ConfigurableApplicationContext cannot be resolved. It is indirectly referenced from required .class files” 
经查询发现 在 这里 发生了和我类似的问题, 原来问题是出现在maven中缓存上,maven的缓存已损坏
按照以下步骤解决:
在命令行中转到项目目录。
确保您的POM.xml与您的命令行在同一个目录中
运行命令 mvn dependency:purge-local-repository
如果您收到构建成功的消息,表示错误已解决。
如果仍然存在错误,请删除(〜/ .m2 / repository / org / springframework)文件夹并运行 mvn package

它现在可以正常工作

https://blog.csdn.net/fujunsfzh/article/details/72673775

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Resolved [org.springframework.web.method.annotation.ModelAttributeMethodProcessor$1: org.springframework.validation.BeanPropertyBindingResult: 4 errors<EOL>Field error in object 'order' on field 'order_id': rejected value [null]; codes [typeMismatch.order.order_id,typeMismatch.order_id,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [order.order_id,order_id]; arguments []; default message [order_id]]; default message [Failed to convert value of type 'null' to required type 'int'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [null] to type [int] for value [null]; nested exception is java.lang.IllegalArgumentException: A null value cannot be assigned to a primitive type]<EOL>Field error in object 'order' on field 'phone': rejected value [null]; codes [typeMismatch.order.phone,typeMismatch.phone,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [order.phone,phone]; arguments []; default message [phone]]; default message [Failed to convert value of type 'null' to required type 'int'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [null] to type [int] for value [null]; nested exception is java.lang.IllegalArgumentException: A null value cannot be assigned to a primitive type]<EOL>Field error in object 'order' on field 'buy': rejected value [null]; codes [typeMismatch.order.buy,typeMismatch.buy,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [order.buy,buy]; arguments []; default message [buy]]; default message [Failed to convert value of type 'null' to required type 'int'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [null] to type [int] for value [null]; nested exception is java.lang.IllegalArgumentException: A null value cannot be assigned to a primitive type]<EOL>Field error in object 'order' on field 'total': rejected value [null]; codes [typeMismatch.order.total,typeMismatch.total,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [order.total,total]; arguments []; default message [total]]; default message [Failed to convert value of type 'null' to required type 'int'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [null] to type [int] for value [null]; nested excep
06-03
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamicFlowController': Unsatisfied dependency expressed through field 'runtimeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'runtimeServiceBean' defined in class path resource [org/activiti/spring/boot/DataSourceProcessEngineAutoConfiguration$DataSourceProcessEngineConfiguration.class]: Unsatisfied dependency expressed through method 'runtimeServiceBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'processEngine' defined in class path resource [org/activiti/spring/boot/DataSourceProcessEngineAutoConfiguration$DataSourceProcessEngineConfiguration.class]: Unsatisfied dependency expressed through method 'processEngine' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springProcessEngineConfiguration' defined in class path resource [org/activiti/spring/boot/DataSourceProcessEngineAutoConfiguration$DataSourceProcessEngineConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.activiti.spring.SpringProcessEngineConfiguration]: Factory method 'springProcessEngineConfiguration' threw exception; nested exception is java.io.FileNotFoundException: class path resource [processes/] cannot be resolved to URL because it does not exist
06-09
### 回答1: 'b'resolved [org.springframework.http.converter.httpmessagenotreadableexception:' 是一个错误信息,意思是Spring框架在解析HTTP消息时出现了无法读取的异常。需要进一步排查,找到具体的异常原因并解决。 ### 回答2: org.springframework.http.converter.HttpMessageNotReadableException是一个很常见的异常,它通常是由于前端传输的请求不符合服务器要求的格式所引起的。 造成org.springframework.http.converter.HttpMessageNotReadableException异常的原因有很多种,下面是一些可能的原因: 1.前端传输的请求体中所包含的数据格式错误,不符合服务器的要求; 2.前端传输的请求体中所包含的数据类型错误,不是服务器接收的类型; 3.前端传输的请求体中所包含的数据缺失了必需的字段,服务器无法解析请求体; 4.前端传输的请求体中所包含的数据重复性过高,服务器无法识别和解析; 针对以上几个情况,可以尝试解决以下方法。 对于第一种情况,前端需要仔细查看服务器要求的数据格式,按照要求进行请求体的组装和传输。 对于第二种情况,需要检查前端发出的请求数据类型是否符合服务器端的接收要求。比如服务器可以接收JSON、XML等格式的请求数据,那么前端需要保证请求数据是正确的格式。 对于第三种情况,前端需要检查请求体中必需的字段是否全部被包含。如果缺失了必需的字段,服务器将无法解析请求体,出现异常。 对于第四种情况,前端需要尽量减少重复性数据的出现。一般情况下,重复性数据过高对服务器的影响比较大,容易引发异常。 最后,如果以上方法都无法解决org.springframework.http.converter.HttpMessageNotReadableException异常,可以查看服务器端日志,定位具体出错位置。通过定位出错位置,可以进一步分析引发异常的原因,然后采取针对性的解决方案,有效地解决这个异常问题。 ### 回答3: org.springframework.http.converter.httpmessagenotreadableexception是一个Spring框架的异常,它通常在当请求的HTTP消息(如POST请求的请求体)无法通过HttpMessageConverter进行读取时抛出。 在Spring MVC中,HttpMessageConverter被用来将请求体转换为特定的Java类型。如果我们没有指定一个正确的HttpMessageConverter或者HttpMessageConverter无法读取请求体,就会导致抛出org.springframework.http.converter.httpmessagenotreadableexception异常。 通常,这种异常的解决方法有以下几种: 1.检查请求体的格式:通常,请求体的格式不正确会导致无法读取。我们需要检查请求体的格式是否与我们设定的HttpMessageConverter兼容。如果不兼容,我们需要重新设定HttpMessageConverter或修改请求体的格式。 2.检查使用的HttpMessageConverter:HttpMessageConverter是将请求体转换为特定Java类型所必需的。如果HttpMessageConverter没有正确配置或没有被使用,会抛出org.springframework.http.converter.httpmessagenotreadableexception异常。我们需要检查使用的HttpMessageConverter是否正确配置,如果没有配置我们需要在Spring配置文件中加入它。 3.检查请求体的编码:如果请求体的编码方式不同于指定的编码方式,则会导致不能读取请求体的异常。我们需要确保请求体编码方式与指定的编码方式相同。 4.检查配置文件:如Spring配置文件中没有配置正确的HttpMessageConverter或没有指定正确的请求处理器。 总之,我们需要检查并确定HttpMessageConverter、请求处理器和请求体的格式、编码方式是否正确,才可以解决org.springframework.http.converter.httpmessagenotreadableexception异常。只有这样,就可以避免由于无法读取请求体而导致的异常,确保应用程序的正常运行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值