ITeye博客

断网运行jar包加载spring文件时,提示cvc-elt.1: Cannot find the declaration of element 'beans'.

ttling · 2015-01-21 22:27 · Spring · Markdown

头疼的spring加载问题:

断网运行jar包加载spring文件时,提示cvc-elt.1: Cannot find the declaration of element 'beans'.

在网上搜索N种方法,最后发现适合我自己程序的是该方法: 替换文件头部 源文件头部

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

替换后

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

当然网上嗨有其他方法可以使用的方法,但是觉得不是好的办法 将spring的目录org放到本地web服务的根目录中,使用本地IP访问,如:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://192.168.11.23/org/springframework/beans/factory/xml/spring-beans-3.0.xsd">

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。