当前位置: 代码迷 >> Java Web开发 >> struts2+hibernate4.1.4整合异常
  详细解决方案

struts2+hibernate4.1.4整合异常

热度:2754   发布时间:2013-02-25 21:15:25.0
struts2+hibernate4.1.4整合错误
Struts Problem Report

Struts has detected an unhandled exception:

Messages:
1.cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.
2.Unable to perform unmarshalling at line number 5 and column 26 in RESOURCE hibernate.cfg.xml. Message: cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.
3.Unable to instantiate Action, struts2.bbs.action.CatagoryAction, defined for 'Catagory_list' in namespace '/admin'Unable to perform unmarshalling at line number 5 and column 26 in RESOURCE hibernate.cfg.xml. Message: cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.
File: com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallerImpl.java
Line number: 396

Stacktraces

Unable to instantiate Action, struts2.bbs.action.CatagoryAction, defined for 'Catagory_list' in namespace '/admin'Unable to perform unmarshalling at line number 5 and column 26 in RESOURCE hibernate.cfg.xml. Message: cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.
  com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:318)
  com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:399)
  com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:198)
  org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
  org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
  com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
  org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475)
  org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
  org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
  java.lang.Thread.run(Thread.java:619)
   

我的配置文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC 
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="hibernate.connection.url">
jdbc:mysql://localhost/bbs2009
</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.username">root</property>
  相关解决方案