Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could n

今天在写ssh的时候遇到了一个这样的问题,连登陆页面都进不去了
报错信息如下:

Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could n_第1张图片

严重: 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 input stream
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1107)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1841)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
	at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3409)
	at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3398)
	at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3386)
	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1341)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1731)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1782)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:363)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:453)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:438)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564)
	... 25 more
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.ithome.user.entity.Classes
	at org.hibernate.cfg.Configuration$MappingsImpl.addClass(Configuration.java:2574)
	at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:172)
	at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3406)
	... 35 more

主要错误为:

Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

翻译:
调用init方法失败;嵌套异常为org.hibernate.无效的映射异常:无法从输入流分析映射文档

问题所在:
Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could n_第2张图片
将hibernate反向生成的映射文件配置路径删除,因为上面已经配置好了改目录下的所有.xml文件,所以就不要重新配置了

解决方法:
删除上图中property所在的映射配置

你可能感兴趣的:(SSH,学习随笔)