java.net.SocketException:网络无法访问(Windows 8上的Eclipse)

时间:2014-01-20 16:26:11

标签: java eclipse scala biojava

我在Windows 8上使用Eclipse运行代码时出现问题。下面的代码在Linux上的Eclipse中运行顺利但在Windows 8中运行不正确。

    package first

    import org.biojava.bio.structure.Atom
    import org.biojava.bio.structure.Structure
    import org.biojava.bio.structure.StructureTools
    import org.biojava.bio.structure.align.StructureAlignment
    import org.biojava.bio.structure.align.StructureAlignmentFactory
    import org.biojava.bio.structure.align.fatcat.FatCatRigid
    import org.biojava.bio.structure.align.fatcat.calc.FatCatParameters
    import org.biojava.bio.structure.align.gui.StructureAlignmentDisplay
    import org.biojava.bio.structure.align.model.AFPChain
    import org.biojava.bio.structure.align.util.AtomCache
    import org.biojava.bio.structure.gui.BiojavaJmol
    import org.biojava.bio.structure.align.gui.jmol.StructureAlignmentJmol

    object Alignment {

      def main(args: Array[String]){

          val name1 = "1YYO.A"
          val name2 = "1YYW.A"
          val cache = new AtomCache()
          val algorithm = StructureAlignmentFactory.getAlgorithm(FatCatRigid.algorithmName)
          val ca1: Array[Atom] = StructureTools.getAtomCAArray(cache.getStructure(name1))
          val ca2: Array[Atom] = StructureTools.getAtomCAArray(cache.getStructure(name2))
          val params: FatCatParameters = new FatCatParameters()
          val afpchain: AFPChain = algorithm.align(ca1, ca2, params)
          afpchain.setName1(name1)
          afpchain.setName2(name2)
          println(afpchain.toFatcat(ca1,ca2))
          StructureAlignmentDisplay.display(afpchain, ca1, ca2)

      }
    }

基本上getStructure方法尝试下载PDB文件但它失败并在下面给出错误。

Problem while downloading PDB ID 1yyo from FTP server.
Failed URL: ftp://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/yy/pdb1yyo.ent.gz
java.net.SocketException: Network is unreachable: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.Socket.connect(Socket.java:579)
    at java.net.Socket.connect(Socket.java:528)
    at sun.net.ftp.impl.FtpClient.openPassiveDataConnection(FtpClient.java:671)
    at sun.net.ftp.impl.FtpClient.openDataConnection(FtpClient.java:710)
    at sun.net.ftp.impl.FtpClient.getFileStream(FtpClient.java:1284)
    at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:428)
    at java.net.URL.openStream(URL.java:1037)
    at org.biojava.bio.structure.io.util.FileDownloadUtils.downloadGzipCompressedFile(FileDownloadUtils.java:96)
    at org.biojava.bio.structure.io.PDBFileReader.downloadPDB(PDBFileReader.java:677)
    at org.biojava.bio.structure.io.PDBFileReader.downloadAndGetInputStream(PDBFileReader.java:795)
    at org.biojava.bio.structure.io.PDBFileReader.getInputStream(PDBFileReader.java:433)
    at org.biojava.bio.structure.io.PDBFileReader.getStructureById(PDBFileReader.java:875)
    at org.biojava.bio.structure.align.util.AtomCache.loadStructureFromPdbByPdbId(AtomCache.java:1173)
    at org.biojava.bio.structure.align.util.AtomCache.getStructure(AtomCache.java:501)
    at first.Alignment$.main(Alignment.scala:24)
    at first.Alignment.main(Alignment.scala)
problem loading:1YYO.A 

我尝试重新安装并更新JDK,关闭防火墙,添加-Djava.net.preferIPv4Stack=true但我仍然无法解决问题。任何建议将不胜感激。非常感谢提前!

1 个答案:

答案 0 :(得分:1)

可能是以下Windows问题:

http://support.microsoft.com/kb/2754804

那个适用于Windows 7,不确定它是否适用于Windows 8。