struts2联网问题

struts遇到的问题:

这个问题只要你机子联网就可以跑起来,但是你一没网就报错了..具体如下:

2010-1-24 21:51:42 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source‘ to ‘org.eclipse.jst.j2ee.server:struts2‘ did not find a matching property.
2010-1-24 21:51:42 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\jdk.1.6\Java\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;F:/jdk.1.6/Java/bin/../jre/bin/client;F:/jdk.1.6/Java/bin/../jre/bin;F:\jdk.1.6\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files\StormII\Codec;C:\Program Files\StormII
2010-1-24 21:51:43 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2010-1-24 21:51:43 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2063 ms
2010-1-24 21:51:43 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2010-1-24 21:51:43 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.16
2010-1-24 21:51:45 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-default.xml]
2010-1-24 21:51:45 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-plugin.xml]
2010-1-24 21:51:45 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:835)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: struts.apache.org - Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:123)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:830)
 ... 25 more
Caused by: java.net.UnknownHostException: struts.apache.org
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
 at java.net.Socket.connect(Socket.java:519)
 at java.net.Socket.connect(Socket.java:469)
 at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
 at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
 at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
 at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
 at sun.net.www.http.HttpClient.New(HttpClient.java:306)
 at sun.net.www.http.HttpClient.New(HttpClient.java:323)
 at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:788)
 at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:729)
 at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:654)
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1282)
 at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:283)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1176)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1075)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:993)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
 at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
 at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
 at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:121)
 ... 26 more
2010-1-24 21:51:45 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2010-1-24 21:51:45 org.apache.catalina.core.StandardContext start
严重: Context [/struts2] startup failed due to previous errors
2010-1-24 21:51:46 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2010-1-24 21:51:46 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2010-1-24 21:51:46 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/140  config=null
2010-1-24 21:51:46 org.apache.catalina.startup.Catalina start
信息: Server startup in 3665 ms

解决不联网无法启动struts2问题
将struts.xml中的声明部分
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts

Configuration 2.1//EN"
    "http://struts.apache.org/dtds/struts-2.1.dtd">

替换为 struts2-core-2.xxx.jar中struts-default.xml的文

件声明
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts

Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

也就是说要保持一致!!O(∩_∩)O~
默认包中用的2.0  而 struts.xml中却用了2.1 所以会出现问题  替换一下就解决了

要注意的地方是:不要添加struts-2.0.Xdtd 只写 struts-2.0.dtd就ok了

时间: 2024-10-12 15:53:14

struts2联网问题的相关文章

解决不联网无法启动struts2问题

Unable to load configuration. - Class: java.net.PlainSocketImplFile: PlainSocketImpl.javaMethod: connectLine: 177 - java/net/PlainSocketImpl.java:177:-1 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java

【Struts2】☆★之解决struts.xml文件提示问题

[Struts2]☆★之解决struts.xml文件提示问题 首先需要下载struts架包,下载步骤详情请看[web开发]☆★之Struts2系列教程[1]搭建Struts2开发环境. 下载之后我们新建一个struts.xml文件,如下: 在联网的情况下,IDE会根据这个路径将struts-2.3.dtdt文件下载下来放在缓冲中,但是有些项目比如做银行项目时,开发环境是不允许连接互联网的,因此怎么解决这个问题呢?ok,往下看 将下载好的struts文件打开,找到这个文件,如下: 那么接下来呢?打

JavaEE SSH框架整合(二) struts2 加载本地dtd文件,action配置

1. 加载struts2的dtd文件,使struts.xml不用联网就能验证,并在eclipse中有提示 在src下创建struts.xml: <?xmlversion="1.0"encoding="UTF-8"?> <!DOCTYPE strutsPUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://strut

深入分析JavaWeb 43 -- Struts2开发入门

一.Struts2概述 1.Struts2是什么? Struts2是一个M(模型-域–范围模型)V(View视图)C(控制器)框架(模型2).框架都是一个半成品.提高开发效率. Struts1是一个MVC框架,非常流行.有很大的缺点.此时一个webwork的框架设计超前,名气不是很大.Struts1+webworkd=struts2.用的是struts1的名字,但是与sruts1没啥关系,struts2的核心是webwork框架. 2.Struts2能干什么? web开发Strust2 核心功能

Maven搭建struts2+spring+hibernate环境

Maven搭建struts2+spring+hibernate环境(一) 本文简单的使用STS的自带的maven插件工具搭建ssh(struts2+spring+hibernate)开发环境,图文并茂,简单上手,适合新手. 关于STS的介绍,请参考另一篇文章<Java IDE介绍:Spring开发利器-spring-tool-suite>地址:http://blog.csdn.net/sgl731524380/article/details/8831540 首先,STS自带的maven的插件已

struts2对action中的方法进行输入校验---xml配置方式(3)

上面两篇文章已经介绍了通过编码java代码的方式实现action方法校验,这里我们介绍另外一种方式:xml配置文件 首先我们来看一个例子: ValidateAction.java: package com.itheima.action; import com.opensymphony.xwork2.ActionSupport; public class ValidateAction extends ActionSupport { private String username; private

解决Struts2配置文件无提示问题

问题:有时在开发第一个Web 项目时,在配置文件中打个”<” 后,并没有任何的提示信息( 快捷键Alt+/ 也不提示) 原因:找不到配置文件头中声明的dtd 文件 <? xml version = "1.0" encoding = "UTF-8" ?> <! DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN&q

struts2服务端与android交互

本文主要包括以下内容 android与struts2服务器实现登陆 android从struts2服务器获取list数据 android上传数据到struts2服务器 服务器端代码 package com.easyway.json.android; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpS

VMware 安装CentOS 6.5图文步骤 以及安装后无法联网的解决办法

一.VMwareWorkstation10 中安装Centos6.5(64位)步骤: 首先下载vmware 和centos6.5 1. 打开VMware-workstation点击“新建虚拟机”,到向导窗口.选择自定义—>下一步.   2. 选择虚拟机硬件兼容workstation10.0,下一步.   3. 选择稍后安装系统,下一步.   4. 选择操作系统为Linux,版本CentOS 64 位.下一步.   5. 给虚拟机命名,指定安装位置,下一步.   6. 配置处理器信息(我这里采用默