首页 > 其他分享 >org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: c

org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: c

时间:2023-04-13 15:38:22浏览次数:41  
标签:java sun Connection internal timed org net com out

今天用dom4j解析xml文件时遇到了一个问题

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 com.mymybatis.MyInvocationHandler.getDataSourceProperty(MyInvocationHandler.java:101)
	at com.mymybatis.MyInvocationHandler.invoke(MyInvocationHandler.java:39)
	at com.sun.proxy.$Proxy0.findById(Unknown Source)
	at com.mymybatis.Test.main(Test.java:13)
Nested exception: 
java.net.ConnectException: Connection timed out: connect
	at java.net.DualStackPlainSocketImpl.connect0(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
	at sun.net.www.http.HttpClient.New(HttpClient.java:308)
	at sun.net.www.http.HttpClient.New(HttpClient.java:326)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1168)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1104)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:998)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:932)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:646)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1300)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1267)
	at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:263)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1164)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1050)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:964)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at org.dom4j.io.SAXReader.read(SAXReader.java:465)
	at org.dom4j.io.SAXReader.read(SAXReader.java:321)
	at com.mymybatis.MyInvocationHandler.getDataSourceProperty(MyInvocationHandler.java:101)
	at com.mymybatis.MyInvocationHandler.invoke(MyInvocationHandler.java:39)
	at com.sun.proxy.$Proxy0.findById(Unknown Source)
	at com.mymybatis.Test.main(Test.java:13)
Nested exception: java.net.ConnectException: Connection timed out: connect
	at java.net.DualStackPlainSocketImpl.connect0(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
	at sun.net.www.http.HttpClient.New(HttpClient.java:308)
	at sun.net.www.http.HttpClient.New(HttpClient.java:326)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1168)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1104)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:998)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:932)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:646)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1300)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1267)
	at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:263)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1164)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1050)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:964)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at org.dom4j.io.SAXReader.read(SAXReader.java:465)
	at org.dom4j.io.SAXReader.read(SAXReader.java:321)
	at com.mymybatis.MyInvocationHandler.getDataSourceProperty(MyInvocationHandler.java:101)
	at com.mymybatis.MyInvocationHandler.invoke(MyInvocationHandler.java:39)
	at com.sun.proxy.$Proxy0.findById(Unknown Source)
	at com.mymybatis.Test.main(Test.java:13)

上网查了一下,原来.因为DOCTYPE的连接网络造成的.

<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

使用了saxreader解析器的时候,会自动解析DOCTYPE里面的内容.如果连接不上网络,则会报连接超时的异常,所以网络不好的情况下关闭自动解析

reader.setFeature(不加载dtd文件,false);
reader.setFeature("http://mybatis.org/dtd/mybatis-3-config.dtd", false);

标签:java,sun,Connection,internal,timed,org,net,com,out
From: https://blog.51cto.com/u_15314615/6188076

相关文章

  • 用quasar+vue3+组合式api VueRouter实现路由嵌套(二级路由)
    前言:本项目使用的是quasar创建,vue3的组合式api语法。部分语法不同,但不影响理解,修改语法后可以在vue2/选项式api项目中运行。效果图:文件目录结构和代码如下:   文中用到的标题栏数据如下:consttitles=ref([{name:"首页",path:"home",children:[]},{......
  • CS231N assignment 2#3 _ dropout 学习笔记 & 解析
    dropout定义&作用&基本实现如课程所说,dropout最大的意义在于防止过拟合.我们还记得,dropout在网络架构上介于激活函数之后,下一层输入之前.想法很简单,就是将隐含层的某些数据屏蔽掉,直接从以输入到下一层,概率为p. 需要注意的是,dropout是仅针对训练而言的,测试......
  • std::cout 的各种输出格式
    在C++中,setf()是流操作符中的一个函数,用于设置格式化标志。它有多种参数,每个参数都代表着一种特定的标志。下面是一些常见的参数及其含义:ios::scientific:使用科学计数法表示浮点数。ios::fixed:使用固定点表示法表示浮点数。ios::left:左对齐输出。ios::right:右对齐输......
  • 【BUG】ExtJS 的Tab Reorder 插件持续更新布局问题解决办法 (Solution to layout issue
    更新记录2023年4月13日初始化。ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16328016.html问题不停的拖动tab栏,会不断更新布局。Draggingthetabbarcontinuouslywillupdatethelayoutconstantly.解决办法进入ExtJS包,打开ux目录下的BoxReorderer.js文件,找......
  • GnuTLS recv error (-110): The TLS connection was non-properly terminated问题的解
    1. sudoapt-getupdate2.sudoapt-getinstallbuild-essentialfakerootdpkg-dev3.sudoapt-getbuild-depgit4.mkdir~/git-openssl5.cd~/git-openssl6apt-getsourcegit ......
  • Linux traceroute命令
    Linuxtraceroute命令Linuxtraceroute命令用于显示数据包到主机间的路径。traceroute指令让你追踪网络数据包的路由途径,预设数据包大小是40Bytes,用户可另行设置。语法traceroute[-dFlnrvx][-f<存活数值>][-g<网关>...][-i<网络界面>][-m<存活数值>][-p<通信端口>][-s<来源地......
  • C# .NET 压缩ZIP时 OOM OutOfMemoryException
    C#.NET压缩ZIP时OOM OutOfMemoryException.ZipArchiveEntry、ZipEntry、SharpZipLib、ZipOutputStream、OutOfMemoryException. 解决方法:可以把零散的文件,存到某个文件夹。再调用ZipFile.CreateFromDirectory来压缩。usingSystem.IO.Compression;Console.WriteLine(......
  • UVa 10344 23 out of 5 (全排列枚举&回溯)
    10344-23outof5Timelimit:3.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1285Yourtaskistowriteaprogramthatcandecidewhetheryoucanfindanarithmetic......
  • android Route模块化路由设计方案
    背景:我们在移动端开发过程,随着业务越来越多,越来越复杂,在架构中会将业务进行剥离和抽取,这样会出现许多业务模块。但是各业务模块又有业务关联,常见的就是Activity之间的跳转。但是,一些大的公司,或者业务线非常多的app大多数采用混合模式,常见的就是H5和app混合,特别是电商商业比较常见。......
  • 网络框架重构之路plain2.0(c++23 without module) 综述
    最近互联网行业一片哀叹,这是受到三年影响的后遗症,许多的公司也未能挺过寒冬,一些外资也开始撤出市场,因此许多的IT从业人员加入失业的行列,而且由于公司较少导致许多人求职进度缓慢,很不幸本人也是其中之一。自从参加工作以来,一直都是忙忙碌碌,开始总认为工作只是为了更好的生活,但是一......