现在在用websphere服务器,在服务器启动时spring的配置文件中会报一个异常,nested exception is org.xml.sax.SAXParseException: cvc-elt.1:找不到元素“beans”的声明。”
spring配置文件 引入DTD这种方式在websphere 6.1 下不成功,必须改成 使用schema这种方式。
DTD:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans default-autowire="byName">
SCHEMA:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
default-autowire="byName">
default-autowire="byName">
本文介绍了解决Websphere环境下Spring配置文件出现的异常问题。通过将DTD验证方式更改为Schema验证方式,有效避免了启动时出现的错误。
711

被折叠的 条评论
为什么被折叠?



