CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Java >  框架、开源

Hibernate连接SQLserver出错,SEVERE: Error parsing XML: XML InputStream(2) The markup in the document preceding the root element

楼主leafxx(因为音乐,所以自由)2005-04-25 16:53:28 在 Java / 框架、开源 提问

以下是我的eclipse的出错信息  
   
  INFO:   Mapping   resource:   com/jeffrey/messagelove/User.hbm.xml  
  Apr   25,   2005   4:49:17   PM   net.sf.hibernate.util.XMLHelper$ErrorLogger   error  
  SEVERE:   Error   parsing   XML:   XML   InputStream(2)   The   markup   in   the   document   preceding   the   root   element   must   be   well-formed.  
  Apr   25,   2005   4:49:17   PM   net.sf.hibernate.cfg.Configuration   addInputStream  
  SEVERE:   Could   not   configure   datastore   from   input   stream  
  org.dom4j.DocumentException:   Error   on   line   2   of   document     :   The   markup   in   the   document   preceding   the   root   element   must   be   well-formed.   Nested   exception:   The   markup   in   the   document   preceding   the   root   element   must   be   well-formed.  
  at   org.dom4j.io.SAXReader.read(SAXReader.java:355)  
  at   net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:287)  
  at   net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:337)  
  at   net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1027)  
  at   net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:983)  
  at   net.sf.hibernate.cfg.Configuration.configure(Configuration.java:911)  
  at   net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)  
  at   com.jeffrey.messagelove.test.HibernateTest.setUp(HibernateTest.java:29)  
  at   junit.framework.TestCase.runBare(TestCase.java:125)  
  at   junit.framework.TestResult$1.protect(TestResult.java:106)  
  at   junit.framework.TestResult.runProtected(TestResult.java:124)  
  at   junit.framework.TestResult.run(TestResult.java:109)  
  at   junit.framework.TestCase.run(TestCase.java:118)  
  at   junit.framework.TestSuite.runTest(TestSuite.java:208)  
  at   junit.framework.TestSuite.run(TestSuite.java:203)  
  at   org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)  
  at   org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)  
  at   org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)  
  Nested   exception:    
   
  不明白什么意思!!!  
   
  以下附上相应配置文件:  
  [hibernate.cfg.xml]  
   
  <?xml   version="1.0"   encoding="utf-8"?>  
  <!DOCTYPE   hibernate-configuration  
          PUBLIC   "-//Hibernate/Hibernate   Configuration   DTD//EN"  
          "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">  
   
  <hibernate-configuration>  
          <session-factory>  
                  <property   name="hibernate.connection.url">  
                          jdbc:jtds:sqlserver://localhost:1433/MessageLove  
                  </property>  
   
                  <property   name="hibernate.connection.driver_class">  
                          net.sourceforge.jtds.jdbc.Driver  
                  </property>  
   
                  <property   name="hibernate.connection.username">  
                          sa  
                  </property>  
   
                  <property   name="hibernate.connection.password">  
                          123456  
                  </property>  
   
                  <property   name="dialect">  
                          net.sf.hibernate.dialect.SQLServerDialect  
                  </property>  
   
                  <property   name="hibernate.show_sql">  
                          True  
                  </property>  
   
                  <property   name="hibernate.use_outer_join">  
                          True  
                  </property>  
   
                  <property   name="hibernate.transaction.factory_class">  
                          net.sf.hibernate.transaction.JDBCTransactionFactory  
                  </property>  
   
                  <mapping   resource="com/jeffrey/messagelove/User.hbm.xml"/>  
   
          </session-factory>  
  </hibernate-configuration>  
   
   
  [User.hbm.xml]  
  <?xml   version="1.0"   ?>  
  <!   DOCTYPE   hibernate-mapping   PUBLIC  
          "-//Hibernate//Hibernate   Mapping   DTD   2.0//EN"  
          "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">  
   
  <hibernate-mapping>  
          <class   name="com.jeffrey.messagelove.User"   table="t_user">  
   
                  <id   name="userName"   type="java.lang.String>  
                          <column   name="t_username"   sql-type="varchar(16)"   not-null="true"/>  
                          <generator   class="assigned"/>  
                  </id>  
   
                  <property   name="password"   type="java.lang.String">  
                          <column   name="t_password"   sql-type="varchar(16)"   not-null="true"/>  
                  </property>  
   
                  <property   name="nickname"   type="java.lang.String">  
                          <column   name="t_nickname"   sql-type="varchar(16)"/>  
                  </property>  
   
          </class>  
  </hibernate-mapping> 问题点数:20、回复次数:1Top

1 楼nimifeng(学海无涯.......苦作舟....理解是美!!!Mars.Neil)回复于 2005-04-25 17:07:06 得分 20

The   markup   in   the   document   preceding   the   root   element   must   be   well-formed.  
  根前面的标记有问题  
  Top

相关问题

  • hibernate !!!
  • hibernate
  • Hibernate配置问题:“严重: problem parsing configuration/hibernate.cfg.xml”
  • hibernate UnresolvableObjectException
  • Hibernate+PostgreSQL
  • hibernate->find
  • jbuilder???hibernate????
  • hibernate的疑问?
  • spring+struts+hibernate
  • hibernate问题

关键词

  • hibernate
  • root
  • document
  • xml
  • markup
  • sf
  • cfg
  • document preceding
  • root element
  • configuration

得分解答快速导航

  • 帖主:leafxx
  • nimifeng

相关链接

  • CSDN Java频道
  • Java类图书
  • Java类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo