java.net.ConnectException:连接超时:连接ANT构建

时间:2016-02-06 05:14:08

标签: ant xmltask

我们正面临java.net.ConnectException:连接超时:在进行ANT构建时连接,这在使用ANT的所有Java开发人员机器中都会发生。 我们试图在web.xml中阻止标记,因为java.sun.com是问题的原因。

但这似乎无法解决问题。 请帮助我们解决此问题。

下面是stacktrace,

[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

2 个答案:

答案 0 :(得分: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任务,它是第三方扩展程序:

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

答案 1 :(得分:0)

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

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

这应该有用。