hibernate3.0 org.dom4j.DocumentException: Connection timed out: connect Nested exception:

所报异常:


exception

java.lang.reflect.InvocationTargetException
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)
 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
 com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
 com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
 com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
 org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
 com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)

  ........此处省略若干行.....

root cause

java.lang.NoClassDefFoundError: Could not initialize class cn.csu.xgb.util.HibernateUtils
 cn.csu.xgb.dao.common.DaoSupport.find(DaoSupport.java:148)
 cn.csu.xgb.dao.HibernateImpl.JczdDaoImpl.find(JczdDaoImpl.java:30)
 cn.csu.xgb.action.xsglAction.ShowJjpyAction.execute(ShowJjpyAction.java:20)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)
 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
 com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
 com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
 com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
 org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
 com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)

 ......此处省略若干行.....

 

root cause                                 此处为根本错误!!!

org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect
    at org.dom4j.io.SAXReader.read(SAXReader.java:484)
    at org.dom4j.io.SAXReader.read(SAXReader.java:321)
    at packageMap3.DomParse.main(DomParse.java:25)
Nested exception:
java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)

 

原因:1.*.hbm.xml  或者 hibernate.cfg.xml 文件头部的 dtd导入url出现错误。

             可能的错误形式:

           <!DOCTYPE hibernate-mapping PUBLIC
                  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                 "
http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

解决方案:

             找到 hibernate3.jar ,分别打开jar包内的hibernate-mapping-3.0.dtd  和 hibernate-configuration-3.0.dtd 文件,比较自己

           所填写的<!DOCTYPE ....> 是不是跟这两个文件里的<!DOCTYPE ....> 分别对应正确。用文件里面的<!DOCTYPE ....>即可解决

            问题!(报此异常的 一种解决办法,我测试正确!)

           正确形式:

           *.hbm.xml中 的为:<!DOCTYPE hibernate-mapping PUBLIC
                                              "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                                              "
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

            hiberante.cfg.xml的为:<!DOCTYPE hibernate-configuration PUBLIC
                                                      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                                      "
http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

 

posted @ 2013-07-01 21:21  javawebsoa  Views(2928)  Comments(0Edit  收藏  举报