Could not parse mapping document from input stream

问题描述

严重:Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'sessionFactory'definedinclasspathresource[applicationContext.xml]:Invocationofinitmethodfailed;nestedexceptionisorg.hibernate.InvalidMappingException:Couldnotparsemappingdocumentfrominputstreamatorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)atjava.security.AccessController.doPrivileged(NativeMethod)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4334)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:719)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)atorg.apache.catalina.core.StandardService.start(StandardService.java:516)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:710)atorg.apache.catalina.startup.Catalina.start(Catalina.java:566)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:606)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)Causedby:org.hibernate.InvalidMappingException:Couldnotparsemappingdocumentfrominputstreamatorg.hibernate.cfg.Configuration.addInputStream(Configuration.java:541)atorg.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:631)atorg.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)...39moreCausedby:org.dom4j.DocumentException:www.hibernate.orgNestedexception:www.hibernate.orgatorg.dom4j.io.SAXReader.read(SAXReader.java:484)atorg.hibernate.cfg.Configuration.addInputStream(Configuration.java:532)...43more十二月12,201411:25:10上午org.apache.catalina.core.StandardContextstart严重:ErrorlistenerStart十二月12,201411:25:10上午org.apache.catalina.core.StandardContextstart严重:Context[/Card_SSH]startupfailedduetopreviouserrors十二月12,201411:25:10上午org.apache.catalina.core.ApplicationContextlog信息:ClosingSpringrootWebApplicationContext十二月12,201411:25:10上午org.apache.coyote.http11.Http11Protocolstart信息:StartingCoyoteHTTP/1.1onhttp-8080十二月12,201411:25:10上午org.apache.jk.common.ChannelSocketinit信息:JK:ajp13listeningon/0.0.0.0:8009十二月12,201411:25:10上午org.apache.jk.server.JkMainstart信息:JkrunningID=0time=0/49config=null十二月12,201411:25:10上午org.apache.catalina.startup.Catalinastart

解决方案

解决方案二:
User.hbm.xml<?xmlversion="1.0"encoding="utf-8"?><!DOCTYPEhibernate-mappingPUBLIC"-//Hibernate/HibernateMappingDTD3.0//EN""http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"><!--MappingfileautogeneratedbyMyEclipsePersistenceTools--><hibernate-mappingpackage="bean"><classname="User"><idname="id"><generatorclass="native"/></id><propertyname="name"/><propertyname="password"/></class></hibernate-mapping>

Card.hbm.xml<?xmlversion="1.0"encoding="utf-8"?><!DOCTYPEhibernate-mappingPUBLIC"-//Hibernate/HibernateMappingDTD3.0//EN""http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"><!--MappingfileautogeneratedbyMyEclipsePersistenceTools--><hibernate-mappingpackage="bean"><classname="Card"><idname="id"><generatorclass="native"/></id><propertyname="name"/><propertyname="phone"/><propertyname="flag"/><many-to-onename="user"column="user_id"cascade="save-update"></many-to-one></class></hibernate-mapping>

解决方案三:
.hbm这些都是自动生成的,一般不会有什么错,我也在SSH整合中出现过这样的问题,可能的原因是你原来项目的错误影响了你现在的项目,你可以尝试清楚workspace,然后弄新的项目,嘻嘻
解决方案四:
springhibernate包冲突,或者缺包。你百度一下spring+hibernate需要的包,最好用MyEclipse直接搭建框架,这样不会缺包或者重复。
解决方案五:
错误应该是Card.hbm.xml未设置字段的type
解决方案六:
类似这种缺少了class<many-to-onename="gradeClass"column="gradeClassId"class="com.supben.pojo.GradeClass"/>

解决方案七:
感谢诸位,中午有事出去了,没有回复很抱歉,问题已经解决了,换了个Tomcat服务器。。
解决方案八:
现在又出了新问题--,搞不明白咋回事严重:Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'userAction'definedinclasspathresource[applicationContext.xml]:Initializationofbeanfailed;nestedexceptionisorg.springframework.beans.TypeMismatchException:Failedtoconvertpropertyvalueoftype[com.sun.proxy.$Proxy7implementingdaoInterface.UserInterface,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised]torequiredtype[dao.UserDAO]forproperty'userdao';nestedexceptionisjava.lang.IllegalArgumentException:Cannotconvertvalueoftype[com.sun.proxy.$Proxy7implementingdaoInterface.UserInterface,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised]torequiredtype[dao.UserDAO]forproperty'userdao':nomatchingeditorsorconversionstrategyfoundatorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)atjava.security.AccessController.doPrivileged(NativeMethod)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1100)atorg.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1618)atjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)atjava.util.concurrent.FutureTask.run(FutureTask.java:262)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)atjava.lang.Thread.run(Thread.java:744)Causedby:org.springframework.beans.TypeMismatchException:Failedtoconvertpropertyvalueoftype[com.sun.proxy.$Proxy7implementingdaoInterface.UserInterface,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised]torequiredtype[dao.UserDAO]forproperty'userdao';nestedexceptionisjava.lang.IllegalArgumentException:Cannotconvertvalueoftype[com.sun.proxy.$Proxy7implementingdaoInterface.UserInterface,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised]torequiredtype[dao.UserDAO]forproperty'userdao':nomatchingeditorsorconversionstrategyfoundatorg.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)...27moreCausedby:java.lang.IllegalArgumentException:Cannotconvertvalueoftype[com.sun.proxy.$Proxy7implementingdaoInterface.UserInterface,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised]torequiredtype[dao.UserDAO]forproperty'userdao':nomatchingeditorsorconversionstrategyfoundatorg.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)atorg.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)atorg.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)...31more

时间: 2024-09-14 02:46:05

Could not parse mapping document from input stream的相关文章

hibernate-Could not parse mapping document from resource

问题描述 Could not parse mapping document from resource Employee.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourc

org.hibernate.InvalidMappingException: Could not parse mapping document from

问题描述 照网上方法,试了很多,但仍解决不了.=========================================================================================================12:01:14,672  INFO Version:37 - HCANN000001: Hibernate Commons Annotations {4.0.1.Final}12:01:14,721  INFO Version:41 - HH

项目启动时报错Element type "property" must be followed by either attri

项目启动时报错Element type "property" must be followed by either attribute specifications, ">" or "/>" 项目启动时,控制台报错,信息如下(有删减): Error creating bean with name 'supplierInfoDAO' defined in class path resource [conf/applicationCont

求大神解答-求BeanCreationException的解决方案

问题描述 求BeanCreationException的解决方案 ERROR ContextLoader:308 - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]:

tomcat的加载配置文件不完全问题,偶尔会包这个错误,大部分时间又正常没错

问题描述 tomcat的加载配置文件不完全问题,偶尔会包这个错误,大部分时间又正常没错 信息: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly.

adf g-s2sh框架启动报错,是不是哪没配置好

问题描述 s2sh框架启动报错,是不是哪没配置好 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 docu

Java 中的 XML:Java 文档模型的用法

xml 在本系列的第一篇文章中,我研究了一些用 Java 编写的主要的 XML 文档模型的性能.但是,在开始选择这种类型的技术时,性能只是问题的一部分.使用方便至少是同样重要的,并且它已是一个主要理由,来支持使用 Java 特定的模型,而不是与语言无关的 DOM . 为切实了解哪个模型真正的作用,您需要知道它们在可用性程度上是如何排名的.本文中,我将尝试进行这个工作,从样本代码开始,来演示如何在每个模型中编码公共类型的操作.并对结果进行总结来结束本文,而且提出了促使一种表示比另一种更容易使用的一

急死人了,SSH整合报错,高手进来帮忙解决啊,org.springframework.beans.factory.BeanCreationException

问题描述 2010-11-13 12:37:39 org.apache.catalina.core.AprLifecycleListener init信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:InstalledMyEclipsebin;D:In

hibernate 日志异常

问题描述 最近学习hibernate,看书感觉可以,实际操作怎么就那么难呢!我用的是:hibernate3.2 eclipse3.3 (没有Myeclipse插件) Mysql6.0一:main()函数 package org.first;import org.hibernate.*;import org.hibernate.cfg.*;public abstract class FirstM {/** * @param args */public static void main(String