Liny_@NotePad

沉迷ACG中

Caused by: java.net.UnknownHostException: struts.apache.org

YOYO posted @ 2012年5月14日 13:23 in 【Java EE】 with tags Struts2 , 12891 阅读

在做demo时遇到的问题,

起初搜了半天似乎都是说没有联网,DTD无法读取。

查了下DTD似乎是优先在本地读取,再读其他的。

但是我的另一个项目就用得好好的,不同点只有引入的jar包。

搞了一上午搞不定,下午仔细一看囧到……

是jar包的版本不一致导致。

之前项目库用的struts是2.0的,因此使用这段代码读取配置:

<!DOCTYPE struts PUBLIC
         "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
         "http://struts.apache.org/dtds/struts-2.0.dtd">

而加入的插件是2.1的版本,插件读取的配置是这个:

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
    "http://struts.apache.org/dtds/struts-2.1.7.dtd">

因为struts-core的jar包里面根本没有这个dtd,难怪会报错……

于是将核心库全换成2.1.7的(手头没有2.0的插件库),便可以正常运行了。

luoloe 说:
2013年8月25日 07:45

Thank you very much! I'm also the same problem.

civaget 说:
2024年1月13日 22:09

Aura at National Gallery Singapore serves up Italian cuisine with a contemporary touch. best fine dining restaurant singapore

civaget 说:
2024年1月17日 21:58

I recommend 오피타임 to anyone in need of relaxation.

civaget 说:
2024年1月18日 05:23

Memories made at 제주셔츠룸 are unforgettable. It's the place where special moments are celebrated and cherished.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter