亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

springmvc 解析spring*.xml配置文件的異常

springmvc 解析spring*.xml配置文件的異常

慕妹3242003 2019-02-24 12:09:32
剛開始接觸springmvc 目標:識別基于注解的控制器類(controller) 過程如下: 1.編寫注解的controller 2.在spring*.xml文件中配置 <context:component-scan base-package="idv.song.controller"/> 3.重新編譯,[重啟tomcat] 4.報錯如下 嚴重: Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/config/springmvc-config.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/TargetSource 報錯中加粗的部分都百度[木得google]過了,沒有合適的答案 自我分析如下: -- bean沒有實例化-- 配置文件中bean配置的錯誤(我的配置文件中只有關于識別注解控制器的配置)--| 嘗試去掉<context:component-scan base-package="idv.song.controller"/> -- 編譯正常(dispatcherServlet.init()成功)| --|base-package沒有寫錯,是不是xml的語法錯誤或者引用content.xsd版本問題? 問題:識別注解控制器的spring配置文件的正確寫法&分析我的問題 `<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:cache="http://www.springframework.org/schema/cache" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd "> <context:component-scan base-package="idv.song.controller"/> <!-- register beans that support the controllers that have annotated method --> <!-- <mvc:annotation-driven></mvc:annotation-driven> <mvc:resources location="/" mapping="/*.html"></mvc:resources> --> <!-- <bean id="/product_input" class="idv.song.controller.InputProductController"></bean> <bean id="/product_save" class = "idv.song.controller.SaveProductController"></bean> --> <bean id="veiwResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/"></property> <property name="suffix" value=".jsp"></property> </bean></beans>`
查看完整描述

1 回答

?
呼啦一陣風

TA貢獻1802條經驗 獲得超6個贊

NoClassDefFoundError 說明類沒有找到,看看依賴的包是否缺少spring-aop-*.jar aopalliance-1.0.jar

查看完整回答
反對 回復 2019-03-01
  • 1 回答
  • 0 關注
  • 1000 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號