今天复习一下Spring和Hibernate的整合,遇到了一个问题,报错信息如下:

  org.springframework.beans.factory.xml。XmlBeanDefinitionStoreException:来自类路径资源的XML文档中的第1行是无效的;嵌套异常                     

  org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from class path resource [] is invalid; nested exception is     org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。

  根据其意思是XML的文件出现了问题,网上说的问题是 更改xml文件的编码、xml文件第一行有空格 等,折腾了几次,最后发现是没有指定解析哪个xml文件。(如图)

  1. 错误:未指定xml文件路径

  

  2. 正确

  

  总结:这个问题折腾了不少时间,算是为自己的马虎大意付出了代价。

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException 前言中不允许有内容 来自类路径资源的XML文档中的第1行是无效的的更多相关文章

  1. 报错org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [bean.xml]

    报这种错的原因基本上是applicationContext.xml文件中bean配置错误,错误如下: org.springframework.beans.factory.BeanCreationExc ...

  2. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined ...

  3. aused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method fai

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleDaoImpl' ...

  4. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [bean.xml]: Invocation of init method failed; nested exception is

    在复制xml文件进行修改的时候,我经常将不小心对原文件进行修改,而导致创建bean出错.报错如下所示: Exception sending context initialized event to l ...

  5. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [app2.xml]: Instantiation of bean failed; nested exception is org.spr

    在学习spring整合hubernate时遇到的问题.c3p0遇到了一个问题,老连不上,显示java.lang.NoClassDefFoundError:com.mchange.v2.ser.Indi ...

  6. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deptDao_a' defined in class path resource [beansAndHibernate.xml]: Cannot resolve reference to bean 'sessionFact

    Error creating bean with name 'deptDao_a' defined in class path 因为更改了类的名字,所以其setter方法没有更改,需要 private ...

  7. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed

  8. 开发Spring过程中几个常见异常(二):Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'a' define

    本异常是小编在运行自己另外一篇博文中的例子时遇到的.(附博文:http://www.cnblogs.com/dudududu/p/8482487.html) 完整异常信息: 警告: Exception ...

  9. java项目报错: org.springframework.beans.factory.BeanCreationException找不到mapper.xml文件

    错误代码 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userSer ...

随机推荐

  1. Ruby  Array类

    Array类 更新: 2017/06/03 更新: 2017/08/31 更新sort的详细内容 更新: 2017/09/07 增加each_with_index, each.with_index(o ...

  2. Linux 常用命令八 find

    一.find命令 find命令用于查找文件. 按文件名字查找: wang@wang:~/workpalce/python$ sudo find / -name "create.txt&quo ...

  3. 【原创】《从0开始学RocketMQ》—集群搭建

    用两台服务器,搭建出一个双master双slave.无单点故障的高可用 RocketMQ 集群.此处假设两台服务器的物理 IP 分别为:192.168.50.1.192.168.50.2. 内容目录 ...

  4. pytest特色与实用插件

    pytest特色 1.fixture的特点 fixture是pytest特有的功能,其特点如下: 必须用pytest.fixture装饰器装饰:fixture有明确的名字,在其他函数(function ...

  5. QT5每日一学(三) QT登陆对话框

    一.使用设计模式创建界面 1.新建Qt Widgets Application,项目名称为login,类名和基类保持MainWindow和QMainWindow不变. 2.完成项目创建后,向项目中添加 ...

  6. Linux磁盘分区、格式化和挂载

    一.查看磁盘使用 [root@iZ88rvassw1Z ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 40G .3G 3 ...

  7. 递归查找无效的符号链接 分类: linux c/c++ 2014-06-02 00:14 345人阅读 评论(0) 收藏

    本程序实现在指定目录下递归查找无效的符号链接. 1.设计思路 逐个读取给定目录中的目录项,判断类型 (1)若为目录,则读取该目录中的目录项并判断类型: (2)若为链接文件,则读取出其指向文件的名称(绝 ...

  8. 转-Mac下Apache Tomcat安装配置

    ava Web如果稍微知道一点,一般对Tomcat都不会陌生,Apache是普通服务器,本身只支持html即普通网页,可以通过插件支持PHP,还可以与Tomcat连通(单向Apache连接Tomcat ...

  9. 017:COM1无法打开

    重新安装系统以后,COM1无法正常打开,重启以后也是如此.到设备管理器下,禁用COM1然后重启可以正常使用.修改COM1为别的COM号,重启以后可以正常使用.用Pcomm控件,打开该串口,错误号是-8 ...

  10. 求指教--hadoop2.4.1集群搭建及管理遇到的问题

    集群规划: 主机名 IP 安装的软件 运行的进程 hadooop 192.168.1.69 jdk.hadoop NameNode.DFSZKFailoverController(zkfc) hado ...