1

我们正面临 java.net.ConnectException: Connection timed out: connect while doing ANT build,这发生在所有使用 ANT 的 java 开发人员机器上。我们试图阻止 web.xml 中的以下标记,因为 java.sun.com 是问题的原因。

但这似乎仍然不能解决问题。请帮助我们解决这个问题。

下面是堆栈跟踪,

[xmltask] java.net.ConnectException: Connection timed out: connect
  [xmltask]     at java.net.PlainSocketImpl.socketConnect(Native Method)
  [xmltask]     at java.net.PlainSocketImpl.doConnect(Unknown Source)
  [xmltask]     at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
  [xmltask]     at java.net.PlainSocketImpl.connect(Unknown Source)
  [xmltask]     at java.net.SocksSocketImpl.connect(Unknown Source)
  [xmltask]     at java.net.Socket.connect(Unknown Source)
  [xmltask]     at java.net.Socket.connect(Unknown Source)
  [xmltask]     at sun.net.NetworkClient.doConnect(Unknown Source)
  [xmltask]     at sun.net.www.http.HttpClient.openServer(Unknown Source)
  [xmltask]     at sun.net.www.http.HttpClient.openServer(Unknown Source)
  [xmltask]     at sun.net.www.http.HttpClient.<init>(Unknown Source)
  [xmltask]     at sun.net.www.http.HttpClient.New(Unknown Source)
  [xmltask]     at sun.net.www.http.HttpClient.New(Unknown Source)
  [xmltask]     at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
  [xmltask]     at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
  [xmltask]     at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
  [xmltask]     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
  [xmltask]     at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask.documentFromStream(XmlTask.java:354)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask.documentFromFile(XmlTask.java:371)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask.access$000(XmlTask.java:27)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask$InputFile.getDocument(XmlTask.java:215)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask.execute(XmlTask.java:620)
  [xmltask]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
  [xmltask]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
  [xmltask]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  [xmltask]     at java.lang.reflect.Method.invoke(Unknown Source)
  [xmltask]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  [xmltask]     at org.apache.tools.ant.Task.perform(Task.java:348)
  [xmltask]     at org.apache.tools.ant.Target.execute(Target.java:390)
  [xmltask]     at org.apache.tools.ant.Target.performTasks(Target.java:411)
  [xmltask]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
  [xmltask]     at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
  [xmltask]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
  [xmltask]     at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
  [xmltask]     at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
  [xmltask]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
  [xmltask]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)

BUILD FAILED
C:\SIGMA\SIGMA_6.0\javasource_6.0\build\build_ecams_ehr.xml:2037: Connection timed out: connect
4

2 回答 2

1

您是否在公司代理背后工作?这将阻止与互联网的连接。您可以配置您的 ANT 脚本以使用代理:

https://ant.apache.org/manual/proxy.html

我从未使用过xmltask,但我推测它可能无法解析 XML 文档中的命名空间。

<root xmlns:e="http://my.domain.com/exampleschema">

  <e:customer>
    <e:name>Joe Bloggs</e:name>
    <e:age>80</e:age>
  </e:table>

</root> 

xmltask不是标准的 ANT 任务,它是第 3 方扩展:

http://www.oopsconsultancy.com/software/xmltask/

于 2016-02-06T07:27:45.617 回答
0

如果您在公司网络上,则情况是您的本地网络 DEV/(无论其名称如何)环境连接遇到网络连接问题。构建过程的一部分是尝试建立主动连接以动态下载构建 ant 文件并失败。

如果代理配置为与 ant 一起使用(检查 env),请检查其是否正确配置,否则手动编辑 ANT 的代理设置,它应该正确构建。点击: https ://ant.apache.org/manual/proxy.html

这应该有效。

于 2017-05-19T16:19:24.063 回答