-2

While starting tomcat, I got this error :

    Caused by: java.io.FileNotFoundException: http://struts.apache.org/dtds/struts-2.3.dtd
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1401)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:654)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1292)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1259)
    at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:260)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1169)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1065)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:978)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
    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:488)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
    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)
    ... 28 more

My code is working till last day. Today this error comes when I try to start tomcat. I am using struts2-core-2.2.1.1.jar and struts2-jquery-plugin-3.3.1.jar files in my project.

Why my code just stops working? Same code is working till yesterday.

Also link http://struts.apache.org/dtds/struts-2.3.dtd gives 404 error. No file found at that location.

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
Abhishek
  • 471
  • 1
  • 4
  • 12

2 Answers2

1

Your code should not try to access the dtd online.

You should not assume a dtd URI is a valid URL, even if this is most often also a URL.

You could provide a local, accessible path to the DTD.

Generally speaking, you should not assume your server has access to "internet" for such things, this is not reliable.

EDIT : using struts 2.3.8 might fix the problem.

http://mvnrepository.com/artifact/org.apache.struts/struts2-core/2.3.8
Samuel EUSTACHI
  • 3,116
  • 19
  • 24
  • But this url is used in struts-plugin.xml from struts2-jquery-plugin-3.3.1.jar file. If I have to change this address to local dtd file, form where do I find this dtd file. I have searched for this file, but didn't find it. – Abhishek Feb 13 '13 at 10:23
  • 1
    You probably don't. I had the same issue jquery-plugin-3.3.1.jar uses struts2.3.dtd. I was using struts 2.2.1 which does not have this file (the dtd files are in struts-core.jar) I even tried un-jaring the version I have, creating a struts-2.3.dtd file by copy/renaming the latest and re-creating the jar. Still didn't work :( – user497087 Feb 14 '13 at 13:19
0

I had exactly the same problem yesterday when a previously working web-app stopped working with the above error. After much head scratching this was a problem 12th Feb 2013 to 13th Feb 2013 and was caused by Apache Struts project migrating servers. The url http://struts.apache.org/dtds/struts-2.3.dtd is now working again as of this morning (06:00 GMT) - however, attempting to download the latest version of Struts (2.3.8) gives me a 403 Forbidden response still.

user497087
  • 1,561
  • 3
  • 24
  • 41
  • This seems to be the struts 's team fault then (but honestly I did not investigate to check if the faulting code, passing the remote url to get the ipunt stream is in a strtus library). If this is the case, I would recommand to report a "bug" to the struts team. This is a too fragile (and totally useless) design in my opinion – Samuel EUSTACHI Feb 14 '13 at 13:40
  • Struts only uses the URL if it can't find the referenced DTD in struts-core.jar (according to the documentation). In this case Struts-2.2.1.core does not contain struts-2.3.dtd which is referenced by plugin.xml in the struts2-jquery-3.3.1 package. – user497087 Feb 14 '13 at 14:42
  • And so, you could expect Struts-2.3.core to fix the problem. Did you try ? – Samuel EUSTACHI Feb 14 '13 at 14:50
  • I've tried to download 2.3.8 but http://struts.apache.org/download.cgi#struts238 is giving a 403 Forbidden response at the moment. – user497087 Feb 14 '13 at 14:52
  • do you use maven ? the depency seems available See : http://mvnrepository.com/artifact/org.apache.struts/struts2-core/2.3.8 – Samuel EUSTACHI Feb 14 '13 at 15:12