码迷,mamicode.com
首页 > 编程语言 > 详细

xom报错 Exception in thread "main" java.net.UnknownHostException: file

时间:2014-10-11 03:55:44      阅读:404      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   io   os   使用   ar   java   

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协议,挺不方便的

xom报错 Exception in thread "main" java.net.UnknownHostException: file

标签:des   style   blog   color   io   os   使用   ar   java   

原文地址:http://www.cnblogs.com/ghgyj/p/4018184.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!