当前位置: 代码迷 >> Java Web开发 >> Could not parse configuration: /hibernate.cfg.xml这个怎么解决
  详细解决方案

Could not parse configuration: /hibernate.cfg.xml这个怎么解决

热度:774   发布时间:2016-04-16 21:59:53.0
Could not parse configuration: /hibernate.cfg.xml这个如何解决?

%%%% Error Creating SessionFactory %%%%
org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
at com.go.dao.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:45)
at com.go.dao.HibernateSessionFactory.getSession(HibernateSessionFactory.java:33)
at com.go.dao.UserDeviceDaoImp.checkDeviceStatus(UserDeviceDaoImp.java:134)
at com.go.action.CourseAction.handleCourse(CourseAction.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
at org.apache.struts.actions.MappingDispatchAction.execute(MappingDispatchAction.java:169)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2440)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2429)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.dom4j.DocumentException: FWK005 parse may not be called while parsing. Nested exception: FWK005 parse may not be called while parsing.
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1532)
... 36 more

我的hibernate.cfg.xml如下:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="myeclipse.connection.profile">
goDb
</property>
<property name="connection.url">
jdbc:mysql://192.168.1.125:3306/go?characterEncoding=utf-8
</property>
<property name="connection.username">root</property>
<property name="connection.password">admin123</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="dialect">
com.go.dao.CustomDialect
</property>
<mapping resource="com/go/domain/goAccount.hbm.xml" />
<mapping resource="com/go/domain/goDevice.hbm.xml" />
<mapping resource="com/go/domain/goFunctionalStatus.hbm.xml" />
<mapping resource="com/go/domain/goUserDevice.hbm.xml" />
<mapping resource="com/go/domain/goNews.hbm.xml" />
<mapping resource="com/go/domain/goStory.hbm.xml" />
<mapping resource="com/go/domain/Radio.hbm.xml" />
<mapping resource="com/go/domain/FirstCategory.hbm.xml" />
<mapping resource="com/go/domain/RelationBetweenCategories.hbm.xml" />
<mapping resource="com/go/domain/SecondaryCategory.hbm.xml" />
  相关解决方案