0
我在使用Windows 8上的Eclipse運行代碼時遇到了問題。以下代碼在Linux上的Eclipse上運行流暢,但在Windows 8中運行不正常。java.net.SocketException:網絡無法訪問(Windows 8上的Eclipse)
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
但我還是解決不了問題。任何建議將不勝感激。提前謝謝了!
可以在你的機器,你先檢查DNS ?然後手動檢查瀏覽器的網址是否可訪問? –
您是否嘗試使用別的程序訪問URL ftp://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/yy/pdb1yyo.ent.gz? (例如瀏覽器) –
是的,我可以通過瀏覽器訪問網址。 – zamk