在本地机器上运行的Web应用程序

时间:2011-01-29 10:38:36

标签: java eclipse jboss struts

开发Web应用程序:

Ide:Eclipse helios。 jdk使用:1.6 struts框架工作:1.2 服务器:jboss 4.0

项目在localhost端口号8080中运行。

即,网址为:http://localhost:8080/mfirst

它在互联网连接方面很好用。如果我拔掉互联网连接,它会抛出错误,找到动作映射和动作表单类。

我所有的tld和jar文件仅引用本地位置..

任何身体帮助请...

在JSP PAGE中:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /index.jsp:21

**LINE 21 IS:**



21: html:form  name="loginForm" type="com.product.form.loginform" action="/Login.do" onsubmit="return Validatelogin(this);"

在控制台中显示

...........
16:28:09,031 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
16:28:09,109 ERROR [ActionServlet] Parsing error processing resource path 
java.net.UnknownHostException: struts.apache.org
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source).
at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
    at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.commons.digester.Digester.parse(Digester.java:1572)
    at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1006)
    at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
    at javax.servlet.GenericServlet.init(GenericServlet.java:211)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
    at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.apache.catalina.core.StandardContext.init(StandardContext.java:5116)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
.
.
.
.
16:28:19,046 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
16:28:19,046 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
16:28:19,046 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
    at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
    at org.apache.jsp.index_jsp._jspx_meth_html_form_0(index_jsp.java:181)

4 个答案:

答案 0 :(得分:2)

您正在使用的某些xml配置文件可能包含对DTD的过时引用,这些DTD不再分发在您正在使用的jar中。因此,xml解析器正在尝试通过网络解析那些。

这也有recently happened in hibernate,我发现应用程序需要额外的5秒才能启动。

答案 1 :(得分:2)

您的堆栈跟踪告诉整个故事:

  

解析错误处理资源路径   的java.net.UnknownHostException:   struts.apache.org at   java.net.PlainSocketImpl.connect(未知   来源)at   java.net.SocksSocketImpl.connect(未知   来源)at   java.net.Socket.connect(未知   来源)at   java.net.Socket.connect(未知   资源)。在   sun.net.NetworkClient.doConnect(未知   来源)at   sun.net.www.http.HttpClient.openServer(未知   来源)at   sun.net.www.http.HttpClient.openServer(未知   来源)at   sun.net.www.http.HttpClient。(未知   来源)at   sun.net.www.http.HttpClient.New(未知   来源)at   sun.net.www.http.HttpClient.New(未知   来源)at   sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(未知   来源)at   sun.net.www.protocol.http.HttpURLConnection.plainConnect(未知   来源)at   sun.net.www.protocol.http.HttpURLConnection.connect(未知   来源)at   sun.net.www.protocol.http.HttpURLConnection.getInputStream(未知   来源)at   org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(未知   来源)at   org.apache.xerces.impl.XMLEntityManager.startEntity(未知   来源)at   org.apache.xerces.impl.XMLEntityManager.startDTDEntity(未知   来源)at   org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(未知   来源)at   org.apache.xerces.impl.XMLDocumentScannerImpl $ DTDDispatcher.dispatch(未知   来源)at   org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(未知   来源)

由于struts.apache.org正在尝试使用XMLEntityManager连接到此网站,您的应用程序正在尝试连接到HttpURLConnection

解决方案:下载您缺少的DTD并将其添加到您的应用程序路径中,以便可以在本地找到它。

答案 2 :(得分:1)

即使我遇到同样的问题。经过彻底的分析后,我发现我的WEB-INF / lib文件夹中有多个版本的struts jar。删除我不需要的版本后,它解决了问题。

答案 3 :(得分:0)

在struts配置文件中搜索“struts.apache.org”的参考,如果您从struts下载xsd后发现有任何替换它的本地位置