markbug 2015-12-12 06:56 采纳率: 77.8%
浏览 1708
已采纳

Spring配置文件中DOCTYPE与<beans xmlns>冲突问题

这是DPCTYPE
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
这是beans里的配置
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"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

        这是我接下来的通知类

        <bean id="advices" class="advice.Advices"></bean>

<aop:config>
    <!-- 调用日志类 -->
    <aop:aspect id="advice" ref="advices">
        <aop:pointcut expression="execution(* action.*.*(..))" id="log"/>
        <aop:before method="before" pointcut-ref="log"/>
        <aop:after method="afterReturning" pointcut-ref="log"/>
        <aop:after-throwing method="afterThrowing" pointcut-ref="log"/>
    </aop:aspect>

</aop:config>


但是用tomcat运行下来会报这个错

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [xml/spring-advice.xml]
Offending resource: ServletContext resource [/WEB-INF/classes/applicationContext.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/classes/xml/spring-advice.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Attribute "xmlns" must be declared for element type "beans".
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/classes/xml/spring-advice.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Attribute "xmlns" must be declared for element type "beans".
Caused by: org.xml.sax.SAXParseException: Attribute "xmlns" must be declared for element type "beans".

  • 写回答

1条回答 默认 最新

  • jinxiuwei 2015-12-12 07:14
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求给定范围的全体素数p的(p-2)的连乘积
  • ¥15 VFP如何使用阿里TTS实现文字转语音?
  • ¥100 需要跳转番茄畅听app的adb命令
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页