The resource identified by this request is only capable of generating respon

The resource identified by this request is only capable of generating respon
参考https://blog.csdn.net/qq_38404440/article/details/80570915
配置文件增加:

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
		<property name="messageConverters">
			<list>
				<ref bean="mappingJacksonHttpMessageConverter" />
			</list>
		</property>
	</bean>
	<bean id="mappingJacksonHttpMessageConverter"
		class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
		<property name="supportedMediaTypes">
			<list>
				<value>application/json;charset=UTF-8</value>
			</list>
		</property>
	</bean>

随后报错

cvc-complex-type.2.3: Element 'beans' cannot have character [children], because the type's content t

参考原文链接:https://blog.csdn.net/mafan121/article/details/43266733
错误原因:Spring在初始化的时候无法识别applicationContext.xml中的元素。
可能产生该错误的原因:网上复制的代码直接粘贴到了xml文件中,而网上的代码可能不符合xml规范

解决办法:1.去掉xml文件中的中文注解,因为复制的有些注解Spring不能识别。

              2.若仍然有错,则尝试修改多余的空格,因为中文空格Spring有可能识别错误。

              3.最后的绝招:重新手动抄写一遍文件内容,保存。
 Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0' defined in class path resource [applicationContext_consumer.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException

NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException
原因缺少jar包
第一次导入2.7.0版本的,反复格式化不成;
第二次导入2.1.0版本的,格式化后,关闭eclipse后重启,项目可以正常运行了,这一路的坎坷。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值