I have this code:
if (file.exists()) {
Document doc = builder.parse(file);
NodeList list = doc.getElementsByTagName("property");
System.out.println("XML Elements: ");
for (int ii = 0; ii < list.getLength(); ii++) {
line 2 gives following exception
E:\workspace\test\testDomain\src\com\test\ins\nxg\maps\Right.hbm.xml
...***java.net.SocketException: Operation timed out: connect:could be due to invalid address
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:372)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:233)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:220)
Parhaps the DocumentBuilder is unsuccessfully trying to access a DTD via a network socket for your XML document?
If there are DTD references in the XML document, try editing them out to prove the cause.
If that fixes your problem, I think you can use an EntityResolver for a more permanent solution, but I've not done it myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With