Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 休眠映射在脱机模式下不工作_Java_Spring_Hibernate - Fatal编程技术网

Java 休眠映射在脱机模式下不工作

Java 休眠映射在脱机模式下不工作,java,spring,hibernate,Java,Spring,Hibernate,我们正在进行灾难恢复练习,一些Hibernate+Spring应用程序并没有出现以下错误 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init m

我们正在进行灾难恢复练习,一些Hibernate+Spring应用程序并没有出现以下错误

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/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:1337)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
                at java.security.AccessController.doPrivileged(AccessController.java:214)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:1029)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:977)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
                ... 55 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
                at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:541)
                at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:638)
                at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
                ... 67 more
**Caused by: org.dom4j.DocumentException: Server returned HTTP response code: 504 for URL: http://www.jboss.org/dtd/hibernate/hibernate-mapping-3.0.dtd Nested exception: Server returned HTTP response code: 504 for URL: http://www.jboss.org/dtd/hibernate/hibernate-mapping-3.0.dtd**
                at org.dom4j.io.SAXReader.read(SAXReader.java:484)
                at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:532)
                ... 71 more
hbm映射XML文件已被删除

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

应该如何指定系统DTD引用,以便Hibernate从Hibernate.jar读取DTD,而不是在文件系统中查找它?

查看Hibernate的DTD源代码解决以下问题

<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 

是的,开源

下载此文件并在本地使用


与配置文件相同

下载dtd文件并在本地使用它将起作用

发布的答案发生了什么?此答案已被“所有者删除”。
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
                at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:541)
                at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:638)
                at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
                ... 72 more
Caused by: org.dom4j.DocumentException: C:\IBMSOA\SDP70\runtimes\base_v61\profiles\AppSrvWSFP01\hibernate-mapping-3.0.dtd (The system cannot find the file specified.) Nested exception: C:\IBMSOA\SDP70\runtimes\base_v61\profiles\AppSrvWSFP01\hibernate-mapping-3.0.dtd (The system cannot find the file specified.)
                at org.dom4j.io.SAXReader.read(SAXReader.java:484)
                at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:532)
                ... 76 more
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">