`
guohf
  • 浏览: 417663 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

java.net.UnknownHostException: www.springframework.org

 
阅读更多

错误信息: 
2016-07-27 15:28:25 - [ INFO ] Loading XML bean definitions from file [D:\apache-tomcat-6.0.35\webapps\StandardEsm\WEB-INF\classes\applicationContext-timer.xml] 
2016-07-27 15:28:25 - [ ERROR ] Context initialization failed 
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file [D:\apache-tomcat-6.0.35\webapps\StandardEsm\WEB-INF\classes\applicationContext-timer.xml]; nested exception is java.net.UnknownHostException: www.springframework.org 
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:409) 
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335) 
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) 
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) 
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) 
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540) 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454) 
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) 
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) 
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) 
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206) 
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705) 
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) 
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) 
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601) 
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079) 
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002) 
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506) 
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317) 
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324) 
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) 
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065) 
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) 
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) 
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) 
at org.apache.catalina.core.StandardService.start(StandardService.java:525) 
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) 
at org.apache.catalina.startup.Catalina.start(Catalina.java:595) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) 
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 
Caused by: java.net.UnknownHostException: www.springframework.org 
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178) 
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) 
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 
at java.net.Socket.connect(Socket.java:579) 
at java.net.Socket.connect(Socket.java:528) 
at sun.net.NetworkClient.doConnect(NetworkClient.java:180) 
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) 
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) 
at sun.net.www.http.HttpClient.(HttpClient.java:211) 
at sun.net.www.http.HttpClient.New(HttpClient.java:308) 
at sun.net.www.http.HttpClient.New(HttpClient.java:326) 
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:997) 
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:933) 
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:851) 
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1301) 
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:643) 
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1297) 
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1264) 
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:263) 
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImplDTDDriver.dispatch(XMLDocumentScannerImpl.java:1164)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImplDTDDriver.next(XMLDocumentScannerImpl.java:1050)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:964) 
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) 
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) 
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.DOMParser.parse(DOMParser.java:243) 
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347) 
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) 
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:428) 
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) 
… 37 more 
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 
原因:applicationContext-timer.xml中DOCTYPE声明引起的, 
找不到主机www.springframework.org,因为不能访问互联网,如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  • 1
  • 2
  • 1
  • 2

解决方法: 
将applicationContext-timer.xml中

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  • 1
  • 2
  • 1
  • 2

改成:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
               http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5

修改以后程序正常。 
这是我替换jar包后出现的问题,替换前,没有问题,不知道是不是jar包问题。

分享到:
评论

相关推荐

    Caused by: java.net.UnknownHostException: openapi.alipay.com

    Caused by: java.net.UnknownHostException: openapi.alipay.com

    linux系统下部署TOMCAT错误java.net.UnknownHostException bogon bogon

    linux系统下部署TOMCAT异常错误java.net.UnknownHostException :bogon: bogon 主要原因是主机映射原因 修改hosts文件即可

    linux系统下部署TOMCAT错误java.net.UnknownHostException bogon bogon.docx

    jmeter-plugins-manager-1.4.jar插件

    支持JMS(Java消息服务)协议,使得JMeter可以用于测试消息中间件的性能。 5. **Graph Results** 提供了丰富的图表组件,如响应时间和吞吐量图,帮助用户直观地理解测试结果。 四、注意事项 在使用Plugins ...

    consul客户端本地开发

    例如,在Java应用中,可以使用官方提供的`consul-client`库,通过`Registration`对象设置服务信息并调用`AgentService.register()`方法。对于其他语言,也有相应的SDK或HTTP请求实现。 5. **健康检查** Consul支持...

    DBeaver连接mysql数据库图文教程

    **DBeaver 连接 MySQL 数据库的详细步骤** DBeaver 是一款强大的数据库管理工具,因其免费、开源且支持多种数据库的特点,深受开发者和DBA的青睐。它提供了直观的用户界面,使得数据库的管理和操作变得更加简单。...

    java HashMapDemo.java

    java HashMapDemo.java

    java、.net

    Java 和 .NET 是两个主要的软件开发平台,它们各自提供了丰富的工具和技术来构建各种类型的应用程序。这两个平台在很多方面都有交集,但也各有特点。 Java 是一种面向对象的编程语言,由Sun Microsystems(现在是...

    项目源码-java网络五子棋游戏

    【项目源码】-java网络...import java.net.UnknownHostException; import java.sql.Time; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; /** * 登录面板 *

    ResidentialAreaMap:ResidentialAreaMap-android

    参考百度Java文档Android Studio模拟定位服务 (安装插件)无法从百度获取地图数据错误显示如下: java.net.UnknownHostException: Unable to resolve host "loc.map.baidu.com": No address associated with ...

    项目源码-java企业QQ项目

    import java.net.UnknownHostException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java...

    srping-cloud-alibaba-nacos-feign.zip

    《Spring Cloud Alibaba Nacos与Feign的整合应用详解》 在微服务架构中,服务间的通信是关键一环。Spring Cloud Alibaba提供了丰富的组件,其中包括Nacos作为服务注册与配置中心,以及Feign作为声明式服务调用工具...

    java网络编程示例

    import java.net.UnknownHostException; public class TCPClient { public static void main(String[] args) { try { Socket socket = new Socket("127.0.0.1",4444); OutputStream oStream = socket....

    Android错误解决方法大集合

    一、 android java.net.UnknownHostException: Unable to resolve host"...": No address associated 错误 该错误是 Android 开发中常见的错误,主要是由于网络连接未开启或 Manifest 文件未标明网络访问权限所致。...

    解决linux找不到hostname的处理

    java.net.UnknownHostException: java: java: No address associated with hostname at java.net.InetAddress.getLocalHost(InetAddress.java:1475) at net.sf.ehcache.Cache.&lt;clinit&gt;(Cache.java:222) ``` 此...

    ip6-java.zip

    7. **配置和属性**:Java系统属性如`java.net.preferIPv6Addresses`和`java.net.preferIPv4Stack`可以用来配置系统首选的IP版本。 8. **异常处理**:处理网络编程中常见的异常,如`UnknownHostException`, `...

    TCP并发上传——java源码

    import java.net.UnknownHostException; public class ClientDemo { public static void main(String[] args) { try { InputStream in = new FileInputStream("D:\\Client"); byte[] buf = new byte[1024*1024...

    JAVA 实现 ping

    一段JAVA代码 实现ping功能 import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; import java.nio.channels.SocketChannel;

    计算机网络实验报告 获取MAC socket通信

    import java.net.UnknownHostException; public class FileClient { /** * @param args */ public static void main(String[] args) { // 文件的输出流 try { java.io.FileOutputStream fos = new ...

    用java获取IP地址

    import java.net.UnknownHostException; public class NsLookup { public static void main(String[] args) { try { InetAddress address = InetAddress.getByName(args[0]); // 获取指定域名的InetAddress对象 ...

Global site tag (gtag.js) - Google Analytics