Guestinfo.hbm(1)The markup declarations contained or pointed to by the document type declaration must be well-formed

今天启动ssh项目是居然报错了,还提示要联网启动,看了看错误信息发现,肯定是Hibernate映射文件的声明头出错了,仔细一下:

hbm.xml中的dtd头直接是连接www.hibernate.org的,而不是sourceforge的,使用过HIbernate的同仁都应该知道,一般你下载Hibernate是从sourceforge上下载的,出错hbm.xml具体配置如下:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

正确配置是将上述蓝底红字改为:http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

附加:出错信息

08:12:39,591 ERROR [org.hibernate.util.XMLHelper] (MSC service thread 1-6) Error parsing XML: C:\Java\jboss-as-7.1.1.Final\standalone\deployments\qsmes.war\WEB-INF\classes\com\njutcm\qsmes\Domain\hbm\Guestinfo.hbm.xml(1) The markup declarations contained or pointed to by the document type declaration must be well-formed.
08:12:39,607 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-6) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from file C:\Java\jboss-as-7.1.1.Final\standalone\deployments\qsmes.war\WEB-INF\classes\com\njutcm\qsmes\Domain\hbm\Guestinfo.hbm.xml
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:591) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) [org.springframework.context-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469) [org.springframework.context-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) [org.springframework.web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) [org.springframework.web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [org.springframework.web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from file C:\Java\jboss-as-7.1.1.Final\standalone\deployments\qsmes.war\WEB-INF\classes\com\njutcm\qsmes\Domain\hbm\Guestinfo.hbm.xml
    at org.hibernate.cfg.Configuration.addFile(Configuration.java:325) [hibernate3.jar:3.2.6.ga]
    at org.hibernate.cfg.Configuration.addDirectory(Configuration.java:668) [hibernate3.jar:3.2.6.ga]
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:710) [org.springframework.orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188) [org.springframework.orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    ... 20 more
Caused by: org.dom4j.DocumentException: Error on line 1 of document http://10.10.0.248 : The markup declarations contained or pointed to by the document type declaration must be well-formed. Nested exception: The markup declarations contained or pointed to by the document type declaration must be well-formed.
    at org.dom4j.io.SAXReader.read(SAXReader.java:482) [dom4j-1.6.1.jar:1.6.1]
    at org.dom4j.io.SAXReader.read(SAXReader.java:264) [dom4j-1.6.1.jar:1.6.1]
    at org.hibernate.cfg.Configuration.addFile(Configuration.java:311) [hibernate3.jar:3.2.6.ga]
    ... 25 more

08:12:39,639 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/qsmes]] (MSC service thread 1-6) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from file C:\Java\jboss-as-7.1.1.Final\standalone\deployments\qsmes.war\WEB-INF\classes\com\njutcm\qsmes\Domain\hbm\Guestinfo.hbm.xml
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:591) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) [org.springframework.context-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469) [org.springframework.context-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) [org.springframework.web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) [org.springframework.web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [org.springframework.web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from file C:\Java\jboss-as-7.1.1.Final\standalone\deployments\qsmes.war\WEB-INF\classes\com\njutcm\qsmes\Domain\hbm\Guestinfo.hbm.xml
    at org.hibernate.cfg.Configuration.addFile(Configuration.java:325) [hibernate3.jar:3.2.6.ga]
    at org.hibernate.cfg.Configuration.addDirectory(Configuration.java:668) [hibernate3.jar:3.2.6.ga]
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:710) [org.springframework.orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188) [org.springframework.orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) [org.springframework.beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    ... 20 more
Caused by: org.dom4j.DocumentException: Error on line 1 of document http://10.10.0.248 : The markup declarations contained or pointed to by the document type declaration must be well-formed. Nested exception: The markup declarations contained or pointed to by the document type declaration must be well-formed.
    at org.dom4j.io.SAXReader.read(SAXReader.java:482) [dom4j-1.6.1.jar:1.6.1]
    at org.dom4j.io.SAXReader.read(SAXReader.java:264) [dom4j-1.6.1.jar:1.6.1]
    at org.hibernate.cfg.Configuration.addFile(Configuration.java:311) [hibernate3.jar:3.2.6.ga]

 

posted @ 2014-10-07 08:27  谢佳东/馨予希  阅读(1691)  评论(0编辑  收藏  举报