4

我不知道为什么当我尝试运行一个确切的项目(struts2+hibernate+mysql)时,它会给我 404 错误,但是在其他项目中我没有这个问题。是因为 MySQL jar 还是因为struts2-dojo-plugin-2.3.4.jar(如“Caused By”中所述)?我需要一个解决方案,因为我总是必须连接到互联网才能开发。非常感谢你。

31 juil. 2012 16:37:52 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_22\bin;.;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.5.0_22/bin/client;C:/Program Files/Java/jre1.5.0_22/bin;C:/Program Files/Java/jre1.5.0_22/lib/i386;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;A:\OraHome_2\bin;C:\oracle\product\10.2.0\db_4\bin;C:\OraHome_1\bin;A:\oracle\product\10.2.0\db_1\bin;C:\Program Files\Java\jdk1.6.0_18\bin;C:\Program Files\Java\jdk1.6.0_18\jre\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Autodesk\Backburner\;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Qt\2010.05\bin;C:\MinGW\bin;C:\wamp\bin\php\php5.3.0\;C:\wamp\php_includes\ZendFramework-1.11.11\bin;C:\Program Files\Rational\common;C:\Program Files\MATLAB\R2009b\runtime\win32;C:\Program Files\MATLAB\R2009b\bin;C:\Program Files\Windows Live\Shared;C:\Program Files\Nmap;C:\Program Files\EclipseJEE;
31 juil. 2012 16:37:52 org.apache.tomcat.util.digester.SetPropertiesRule begin
ATTENTION: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:HelloWorld' did not find a matching property.
31 juil. 2012 16:37:52 org.apache.coyote.http11.Http11Protocol init
INFO: Initialisation de Coyote HTTP/1.1 sur http-8080
31 juil. 2012 16:37:52 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 691 ms
31 juil. 2012 16:37:52 org.apache.catalina.core.StandardService start
INFO: Démarrage du service Catalina
31 juil. 2012 16:37:52 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
31 juil. 2012 16:37:52 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(A:\Struts-Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\HelloWorld\WEB-INF\lib\javax.servlet-1.0.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
log4j:WARN No appenders could be found for logger (org.apache.tiles.impl.BasicTilesContainer).
log4j:WARN Please initialize the log4j system properly.
31 juil. 2012 16:37:54 org.apache.catalina.core.StandardContext filterStart
GRAVE: Exception au démarrage du filtre struts2
Unable to load configuration. - [unknown location]
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:48)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: Unable to load jar:file:/A:/Struts-Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/HelloWorld/WEB-INF/lib/struts2-dojo-plugin-2.3.4.jar!/struts-plugin.xml - [unknown location]
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:890)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:144)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:111)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:164)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 22 more
Caused by: struts.apache.org - [unknown location]
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:885)
    ... 26 more
Caused by: java.net.UnknownHostException: struts.apache.org
    at java.net.PlainSocketImpl.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 com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:113)
    ... 27 more
31 juil. 2012 16:37:54 org.apache.catalina.core.StandardContext start
GRAVE: Error filterStart
31 juil. 2012 16:37:54 org.apache.catalina.core.StandardContext start
GRAVE: Erreur de démarrage du contexte [/HelloWorld] suite aux erreurs précédentes
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
31 juil. 2012 16:37:54 org.apache.coyote.http11.Http11Protocol start
INFO: Démarrage de Coyote HTTP/1.1 sur http-8080
31 juil. 2012 16:37:55 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
31 juil. 2012 16:37:55 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/44  config=null
31 juil. 2012 16:37:55 org.apache.catalina.startup.Catalina start
INFO: Server startup in 2652 ms
4

2 回答 2

0

来自http://www.coderanch.com/t/536448/Struts/run-Struts-offlinehttp://struts.1045723.n5.nabble.com/S2-attempts-to-access-www-opensymphony-com -on-Struts-startup-td3481060.html ...

尝试struts.xml

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

<!DOCTYPE struts SYSTEM "struts-2.0.dtd">

并且不要忘记检查项目中对在线资源的任何其他引用。

于 2012-07-31T18:00:17.817 回答
0

打开 struts2-dojo-plugin-2.3.4.jar 然后打开 struts-plugin.xml 更改http://struts.apache.org/dtds/struts-2.3.dtdstruts-2.3.dtd将更改的文件放回 jar。

于 2013-08-31T06:46:56.580 回答