unknown host exception while parsing an xml file

前端 未结 3 445
粉色の甜心
粉色の甜心 2021-01-18 09:30

when i am trying to parse an xml, i am getting following exception :-

java.net.UnknownHostException: hibernate.sourceforge.net
    at java.net.AbstractPlainS         


        
3条回答
  •  天涯浪人
    2021-01-18 09:58

    I am also trying read from a xml file with dtd tag

    
    

    and code

    File fXmlFile = new File(grammarXML);                   
    DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
    Document doc = dBuilder.parse(fXmlFile);
    

    I was getting the same error.

    java.net.UnknownHostException:
    

    The server where the code is deployed does not have access to w3.org. When i open w3.org in a browser, it is opening connection timed out page. I gave access to w3.org and it solved the issue.

提交回复
热议问题