今天配置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. python测试开发django-39.xadmin详情页面布局form_layout

    前言 xadmin的详情页面默认是一行展示一个字段,可以使用form_layout对详情页面的布局重新设计. 可以设置必填和非必填字段,也可以设置不显示,不可以编辑的字段. models模块 先在mo ...

  2. SharePoint 删除废弃站点步骤

    前言 在SharePoint的日常使用中,经常会有一些废弃的站点需要删除,比如测试站点或者不再使用的站点等,我们应该如何去删除这些站点呢?下面,我们就为大家介绍. 正文 进入SharePoint服务器 ...

  3. SharePoint 应用程序页匿名

    前言 最近,有朋友问开发应用程序页,都是需要先登录再访问,无法开发匿名的应用程序页. 解决方法 其实,SharePoint帮我们提供了匿名访问的应用程序页的方法,只是和普通应用程序页继承的基类不一样, ...

  4. 如何在Windows下运行linux shell脚本

    在工作中情况会在碰到linux下进行执行shell的脚本,而就会使用shell的脚本,但经常使用的Windows的系统,而想在Windows电脑中进行直接shell的脚本,而不用再进行学习其它的脚本语 ...

  5. linux下memcached安装 和redis安装,jdk,tomcat,mysql 安装

    一.memcached安装yum  search  memcachedyum  -y install memcachedmemmcached -h service memcached restartc ...

  6. 抄袭证据之中的一个CMM与CMMI的名称

    以下文字来自我即将完毕的文章,谢博士说她没有抄袭,可是文中实在是有太多的漏洞了. 6.2.7 P120页中: "实际上终于所谓的统一方法论就是标准,尽管作标准并非目的.但标准是必须有的.能够 ...

  7. python 批量重命名

    import osll=os.listdir(".")c=0for f in ll: c=c+1 os.rename(f,str(c)+".jpg")

  8. 操作Wifi的工具类

    有时候需要打开关闭wifi,或者是坚持状态什么的,这里我写了个工具类来完成各种操作,今后还会添加其他的功能.比如链接某个加密/不加密的wifi WifiAdmin.java package com.e ...

  9. Emulator: glTexImage2D: got err pre :( 0x502 internal 0x1908 format 0x1908 type 0x1401

    Go to Tools > AVD Manager > Virtual device configuration > Show advanced settings > Boot ...

  10. 连接MSSQL2008 Express

    (1)打开Manage Studio. (2)click on the  .\sqlexpress, select property, click security, make sure use mi ...