We are getting below error since today noon time IST. Application is working fine since few years but from today noon time it started giving this error.
Element type "struts" must be declared. at (null:26:9) org.xml.sax.SAXParseException; systemId: jar:file:/WEB-INF/lib/struts2-jquery-grid-plugin-2.2.0.jar!/struts-plugin.xml; lineNumber: 26; columnNumber: 9; Element type "struts" must be declared.
We are using Tomcat Server with Java 1.7 version having project with Struts 2.1.6, struts2-jquery-plugin-3.6.1 and struts2-jquery-grid-plugin-2.2.0.
Something had changed but you don't know. Then you need to follow WYSIWYG pattern. The error happens when the application starts. The problem is in the
struts-plugin.xmlwhich is inside the struts2-jquery-grid plugin. The exceptipnorg.xml.sax.SAXParseExceptiontells you that this file cannot be parsed because it either not valid or has a wrong DTD. Then it worth to start reading about plugins.When Struts2 application starts it's looking for configuration files such as
struts.xml,struts-default.xml,struts-plugin.xml.The configuration file
struts-plugin.xmlwhich should be located on classpath had parsed by the SAX parser to validate against document DTD supplied with the document. It has thrown an exception while parsing the document. It means that the document is invalid because it has wrong structure.The line number and column number indicate where the invalid structure had started.
First time you make sure the referenced file exists and it's accessible by the URL.
You can try to replace wrong configuration file or it's DTD and make sure only one configuration file with the same name exists per project.
You should keep this file along source file for making modifications. When you package the project the file should copy to the
WEB-INF/classesin thewararchive. Make sure the file is the same as on the source folder.Make the project clean before the build to remove files used by the previous build.
If something has changed on the server, i.e. Java brand/version installation. Then you need to upgrade it manually.