Why am I seeing the error?
PDB_DIR
is set toC:/PDB files
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>bio_java_maven_hello_world</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.biojava</groupId>
<artifactId>biojava-core</artifactId>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>org.biojava</groupId>
<artifactId>biojava-structure</artifactId>
<version>5.4.0</version>
</dependency>
</dependencies>
</project>
BioJavaPDBHelloWorld.java
package org.example;
import org.biojava.nbio.structure.*;
import org.biojava.nbio.structure.io.PDBFileReader;
public class BioJavaPDBHelloWorld {
public static void main(String[] args) {
try {
PDBFileReader pdbReader = new PDBFileReader();
// Set the path to the local PDB file directory
pdbReader.setPath("C:/PDB files");
// Reading a structure by PDB code
Structure structure = pdbReader.getStructureById("1lvz"); // Example PDB code
// Print the PDB ID
System.out.println("PDB ID: " + structure.getPDBCode());
// Print the title of the structure
System.out.println("Title: " + structure.getPDBHeader().getTitle());
// Print number of atoms in the structure
System.out.println("ID : " + structure.getId());
} catch (Exception e){
e.printStackTrace();
}
}
}
Output:
"C:Program FilesJavajdk-17.0.2binjava.exe" "-javaagent:C:Program FilesJetBrainsIntelliJ IDEA 2023.1.6libidea_rt.jar=53936:C:Program FilesJetBrainsIntelliJ IDEA 2023.1.6bin" -Dfile.encoding=UTF-8 -classpath C:gitbio_java_maven_hello_worldtargetclasses;C:Userspc.m2repositoryorgbiojavabiojava-core5.4.0biojava-core-5.4.0.jar;C:Userspc.m2repositoryorgslf4jslf4j-api1.7.30slf4j-api-1.7.30.jar;C:Userspc.m2repositoryorgapachelogginglog4jlog4j-slf4j-impl2.13.1log4j-slf4j-impl-2.13.1.jar;C:Userspc.m2repositoryorgapachelogginglog4jlog4j-api2.13.1log4j-api-2.13.1.jar;C:Userspc.m2repositoryorgapachelogginglog4jlog4j-core2.13.1log4j-core-2.13.1.jar;C:Userspc.m2repositoryorgbiojavabiojava-structure5.4.0biojava-structure-5.4.0.jar;C:Userspc.m2repositoryorgrcsbciftools-java.7.1ciftools-java-0.7.1.jar;C:Userspc.m2repositoryjavaxannotationjavax.annotation-api1.3.2javax.annotation-api-1.3.2.jar;C:Userspc.m2repositorycomgooglecodegsongson2.8.5gson-2.8.5.jar;C:Userspc.m2repositoryorgrcsbmmtf-api1.0.9mmtf-api-1.0.9.jar;C:Userspc.m2repositoryorgrcsbmmtf-serialization1.0.9mmtf-serialization-1.0.9.jar;C:Userspc.m2repositoryorgmsgpackjackson-dataformat-msgpack.8.18jackson-dataformat-msgpack-0.8.18.jar;C:Userspc.m2repositoryorgmsgpackmsgpack-core.8.18msgpack-core-0.8.18.jar;C:Userspc.m2repositorycomfasterxmljacksoncorejackson-databind2.9.9.3jackson-databind-2.9.9.3.jar;C:Userspc.m2repositorycomfasterxmljacksoncorejackson-annotations2.9.0jackson-annotations-2.9.0.jar;C:Userspc.m2repositorycomfasterxmljacksoncorejackson-core2.9.9jackson-core-2.9.9.jar;C:Userspc.m2repositoryorgrcsbmmtf-codec1.0.9mmtf-codec-1.0.9.jar;C:Userspc.m2repositorycommons-langcommons-lang2.4commons-lang-2.4.jar;C:Userspc.m2repositoryorgbiojavabiojava-alignment5.4.0biojava-alignment-5.4.0.jar;C:Userspc.m2repositoryorgbiojavathirdpartyforester1.038forester-1.038.jar;C:Userspc.m2repositoryjava3dvecmath1.3.1vecmath-1.3.1.jar;C:Userspc.m2repositoryorgjgraphtjgrapht-core1.1.0jgrapht-core-1.1.0.jar;C:Userspc.m2repositoryjavaxxmlbindjaxb-api2.3.0jaxb-api-2.3.0.jar;C:Userspc.m2repositorycomsunxmlbindjaxb-core2.3.0jaxb-core-2.3.0.jar;C:Userspc.m2repositorycomsunxmlbindjaxb-impl2.3.0jaxb-impl-2.3.0.jar;C:Userspc.m2repositoryjavaxactivationactivation1.1.1activation-1.1.1.jar org.example.BioJavaPDBHelloWorld
20:18:48 [main] WARN org.biojava.nbio.structure.align.util.UserConfiguration - Could not read dir from system property PDB_DIR or environment variable PDB_DIR, using system's temp directory C:UserspcAppDataLocalTemp
java.net.ConnectException: Connection timed out: no further information
at java.base/sun.nio.ch.Net.pollConnect(Native Method)
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
at java.base/java.net.Socket.connect(Socket.java:633)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:498)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:246)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:351)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:373)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1309)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1242)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128)
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057)
at org.biojava.nbio.core.util.FileDownloadUtils.downloadFile(FileDownloadUtils.java:126)
at org.biojava.nbio.structure.io.LocalPDBDirectory.downloadStructure(LocalPDBDirectory.java:550)
at org.biojava.nbio.structure.io.LocalPDBDirectory.downloadStructure(LocalPDBDirectory.java:498)
at org.biojava.nbio.structure.io.LocalPDBDirectory.getInputStream(LocalPDBDirectory.java:353)
at org.biojava.nbio.structure.io.LocalPDBDirectory.getStructureById(LocalPDBDirectory.java:327)
at org.example.BioJavaPDBHelloWorld.main(BioJavaPDBHelloWorld.java:16)
Process finished with exit code 0
It sems like the listing is trying to download the file from the Internet.
However, I don’t have any such statement in my listing.
So, what is going on and how can I resolve the issue?