zoukankan      html  css  js  c++  java
  • xom报错 Exception in thread "main" java.net.UnknownHostException: file

    Exception in thread "main" java.net.UnknownHostException: file
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
        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.doConnect(FtpClient.java:958)
        at sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:918)
        at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1013)
        at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:999)
        at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:294)
        at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:393)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:613)
        at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:812)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
        at nu.xom.Builder.build(Unknown Source)
        at nu.xom.Builder.build(Unknown Source)
        at xml2.XOM.main(XOM.java:26)
    package xml2;
    
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    
    import nu.xom.Builder;
    
    import org.xml.sax.XMLReader;
    
    public class XOM {
        public static void main(String[] args) throws Exception {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            factory.setValidating(false);
            factory.setNamespaceAware(true);
    
            SAXParser parser = factory.newSAXParser();
    
            XMLReader reader = parser.getXMLReader();
            reader.setErrorHandler(new SimpleErrorHandler());
    
            Builder builder = new Builder(reader);
            builder.build("contacts.xml");
    
        }
    }

    为什么会报这个错误呢?我用的是xom-1.2.10.jar

    package xml2;
    
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    
    import nu.xom.Builder;
    
    import org.xml.sax.XMLReader;
    
    public class XOM {
        public static void main(String[] args) throws Exception {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            factory.setValidating(false);
            factory.setNamespaceAware(true);
    
            SAXParser parser = factory.newSAXParser();
    
            XMLReader reader = parser.getXMLReader();
            reader.setErrorHandler(new SimpleErrorHandler());
    
            Builder builder = new Builder(reader);
            builder.build("file:\H:\mycodes\java\jbpm\xml2\contacts.xml");
    
        }
    }

    从xom-1.2.10.jar开始使用file协议,挺不方便的

  • 相关阅读:
    Win8 消费者预览版中文版下载地址 官方原版
    Easyui datagrid加载本地Json数据
    myeclipse 8.510.0 安装 svn 方法
    easyui tree使用方法
    安装Oracle 11g r2先决条件检查失败解决方法
    Win8/Win7或XP 双系统安装图文教程
    Oracle存储过程与函数
    MyEclipse 中 使用 TortoiseSVN(1)
    MyEclipse 中 使用 TortoiseSVN(2)
    easyui使用Ajax提交表单,返回Json数据
  • 原文地址:https://www.cnblogs.com/ghgyj/p/4018184.html
Copyright © 2011-2022 走看看