今天配置Spring,遇到一个很奇葩的问题:

Spring.xml的配置文件内容:

<?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:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context/spring-context.xsd
">

测试出错:

Tests in error:
instanceSpring(com.qunar.studyspring.SpringTest): Line 1 in XML document from class path resource [spring.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/tx/; lineNumber: 1; columnNumber: 55; 在 publicId 和 systemId 之间需要有空格。

百思不得其解,后来在网络上搜索了半天,结论就是:前一个是publicID,后一个是SystemId,是一一对应的,位置不能颠倒

http://www.springframework.org/schema/beans publicID
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd SystemId

修改之后:

<?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:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
">

黑色部分就是给我留下深刻记忆的部分,次序颠倒了

Spring 在+publicId+和+systemId+之间需要有空格的更多相关文章

  1. 在 publicId 和 systemId 之间需要有空格。

    spring  applicationContext_datasource.xml中约束错误 org.springframework.beans.factory.xml.XmlBeanDefiniti ...

  2. Spring- 异常org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/context/; lineNumber: 1; columnNumber: 55; 在 publicId 和 systemId 之间需要有空格。

    抛出异常 六月 03, 2018 7:40:44 下午 org.springframework.context.support.AbstractApplicationContext prepareRe ...

  3. spring 自定义schema 加载异常 White spaces are required between publicId and systemId.

    spring 项目启动报错 报错日志如下: Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreExcepti ...

  4. requests(二): json请求中固定键名顺序&消除键和值之间的空格

    继上一篇requests发送json请求的文章后,实际工作中遇到了以下2种情况. 1:服务端要求json字符串,键名的顺序固定  2.服务端对于接收到的json数据中,若key和value之间有空格, ...

  5. xml操作-Nested exception: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId. 异常处理

    异常如下: org.dom4j.DocumentException: Error on line 2 of document file:///D:/workspaces/struts2/lesson0 ...

  6. 正则去掉html标签之间的空格、换行符、tab符,但是保留html标签内部的属性空格

    今天遇到一个比较少见的去空格: 正则去掉html标签之间的空格.换行符.tab符,但是保留html标签内部的属性空格 JS 举例: "<a href='baidu.com' name= ...

  7. css选择器之间的 空格和逗号

    当两个选择器之间有空格的情况下,代表的是子类选择器 .a .b{} 代表的是a类的b子类 而两个选择器之间没有空格的情况下,代表的是同时拥有两个类名的标签 <div class="a ...

  8. HTML行内级元素之间的空格问题

    HTML行内级元素之间的空格问题 1.为什么元素之间会产生空格? 在编写行内级元素(包括inline-block元素)的代码之间如果有空格(换行),在浏览器上就会显示元素之间有空格. 示例代码如下: ...

  9. spring4笔记----报错publicid systemid之间要有空格的解决方法

    <?xml version="1.0" encoding="GBK"?> <beans xmlns:xsi="http://www. ...

随机推荐

  1. C#编程(三十二)----------数组基础

    数组 如果需要使用同一类型的多个对象,就可以使用数组.数组是一种数据结构,他可以包含同一类型的多个元素. 数组的声明 在声明数组时,应先定义数组中元素的类型,其后是一对方括号核一遍变量名.例如:生命一 ...

  2. 基于CentOS的MySQL学习补充三--使用Shell批量创建数据库表

    本文出处:http://blog.csdn.net/u012377333/article/details/47006087 接上篇介绍<基于CentOS的Mysql学习补充二--使用Shell创 ...

  3. [ACM] HDU 2255 奔小康赚大钱 (二分图最大权匹配,KM算法)

    奔小康赚大钱 Problem Description 传说在遥远的地方有一个很富裕的村落,有一天,村长决定进行制度改革:又一次分配房子. 这但是一件大事,关系到人民的住房问题啊. 村里共同拥有n间房间 ...

  4. (转载):ASCII,Unicode和UTF-8 编码

    UTF-8是Unicode的一种实现方式,也就是它的字节结构有特殊要求,所以我们说一个汉字的范围是0X4E00到0x9FA5,是指unicode值,至于放在utf-8的编码里去就是由三个字节来组织,所 ...

  5. java去除数组中重复的元素方法总结

    /* * ArrayUnique.java * Version 1.0.0 * Created on 2017年12月16日 * Copyright ReYo.Cn */ package reyo.s ...

  6. 给hmailserver添加SSL支持

    我们使用stunnel来给hmailserver添加ssl支持,stunnel是一个开源跨平台提供全局TLS/SSL支持的软件,它可以给很多本身不支持ssl的软件来提供安全的加密连接,同样可以用于hm ...

  7. Android之sqlite3命令行简单使用

    首先需要定位到database所在的目录里面,然后使用命令 sqlite3 databasename(数据库的名字)进入 常用命令: 1. .table     列取该数据库下面的数据表名 2. .s ...

  8. 《C#本质论(第4版)》

    <C#本质论(第4版)> 基本信息 作者: (美)Mark Michaelis    Eric Lippert 译者: 周靖 出版社:人民邮电出版社 ISBN:9787115336750 ...

  9. .NetCore中EFCore for MySql整理(二)

    一.简介 EF Core for MySql的官方版本MySql.Data.EntityFrameworkCore 目前正是版已经可用当前版本v6.10,对于以前的预览版参考:http://www.c ...

  10. golang的日志系统log和glog

    go语言有一个标准库,log,提供了最基本的日志功能,但是没有什么高级的功能,如果需要高级的特性,可以选择glog或log4go. 参考:https://cloud.tencent.com/devel ...