2012-09-08 49 views
0

在eclipse中嘗試運行我的應用程序時出現以下異常。在linux中運行struts + tomcat6應用程序+ openJDK錯誤

Caused by: Unable to load configuration. - Class: java.net.AbstractPlainSocketImpl 
    File: AbstractPlainSocketImpl.java 
    Method: connect 
    Line: 158 - java/net/AbstractPlainSocketImpl.java:158:-1 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) 
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374) 
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418) 
    ... 20 more 
    Caused by: Unable to load jar:file:/var/lib/tomcat6/webapps/webapps/cute/WEB-   INF/lib /struts2-jfreechart-plugin-2.3.4.jar!/struts-plugin.xml - Class: java.net.AbstractPlainSocketImpl 
File: AbstractPlainSocketImpl.java 
Method: connect 
Line: 158 - java/net/AbstractPlainSocketImpl.java:158:-1 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:898) 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:143) 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:110) 
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:168) 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55) 
    ... 22 more 
Caused by: struts.apache.org - Class: java.net.AbstractPlainSocketImpl 
File: AbstractPlainSocketImpl.java 
Method: connect 
Line: 158 - java/net/AbstractPlainSocketImpl.java:158:-1 
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115) 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:893) 
    ... 26 more 
Caused by: java.net.UnknownHostException: struts.apache.org 
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:158) 
    at java.net.Socket.connect(Socket.java:546) 
    at java.net.Socket.connect(Socket.java:495) 
    at sun.net.NetworkClient.doConnect(NetworkClient.java:174) 
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:409) 
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:530) 
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:240) 
    at sun.net.www.http.HttpClient.New(HttpClient.java:321) 
    at sun.net.www.http.HttpClient.New(HttpClient.java:338) 
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:814) 
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:755) 
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:680) 
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1005) 
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:653) 
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1291) 
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1258) 
    at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:259) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1167) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1064) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:977) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:624) 
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:486) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:810) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:740) 
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:110) 
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208) 
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525) 
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:392) 
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:113) 
    ... 27 more 

我已經配置在Eclipse中的默認服務器和lib文件夾中添加的jar文件到path.Placed的jar文件。

+0

嗯,幾乎看起來好像當它試圖爲配置文件檢索'.dtd'時發生問題。也許你可以嘗試將DTD複製並粘貼到配置文件的頂部,並查看錯誤是否消失。當然,這不是一個很好的「解決方案」,但是如果它能起作用,那麼你就有了一些工作和解決問題的線索。 – rees

+0

我不認爲我有解決方案。我沒有使用任何DTD。 – Rodex

+0

你沒有使用struts.xml文件嗎?如果您正在使用它,那麼它可能以'<!DOCTYPE struts PUBLIC 「的形式引用頂部的dtd - // Apache Software Foundation // DTD Struts配置2.3 // EN」 「http:// struts。 apache.org/dtds/struts-2.3.dtd「>」。將其替換爲dtd內容(您可以從URL下載)。對任何你有的配置文件做這個,struts.xml,validation.xml文件等。 – rees

回答

0

如果你收到這樣

異常產生的原因:的java.net.UnknownHostException:Struts2的XML配置的建設過程中struts.apache.org

,那麼某些原因造成應用程序成功檢索DTD

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

更改DOCTYPE聲明到本地參考或直接複製粘貼的DTD內容到原來的位置將解決此問題。

+0

我想指出這一點。我使用的是struts2-jfreechart-plugin-2.3.4.jar,它的struts-plugin.xml DTD是2.3,而我在Struts.xml中使用的是2.0。所以下載了struts2-jfreechart-plugin-2.1.8.jar並替換了它。從而解決了這個問題。謝謝@rees。 – Rodex