Reputation: 1
I am facing following error when starting my application
10:35:17,716 ERROR [org.apache.commons.digester.Digester] (ServerService Thread Pool -- 95) Parse Error at line 55 column 18: Element type "form-validation" must be declared.: org.xml.sax.SAXParseException; lineNumber: 55; columnNumber: 18; Element type "form-validation" must be declared.
10:35:17,717 ERROR [org.apache.commons.digester.Digester] (ServerService Thread Pool -- 95) Parse Error at line 57 column 13: Element type "global" must be declared.: org.xml.sax.SAXParseException; lineNumber: 57; columnNumber: 13; Element type "global" must be declared.
10:35:17,718 ERROR [org.apache.commons.digester.Digester] (ServerService Thread Pool -- 95) Parse Error at line 68 column 43: Element type "validator" must be declared.: org.xml.sax.SAXParseException; lineNumber: 68; columnNumber: 43; Element type "validator" must be declared.
and so on for all the other tags as well
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.3.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd">
It seems that xml file is not using dtd file properly to parse the xml elements as required
For reference my xml file is present inside abc.ear -> xyz.war -> WEB-INF This is location for my validator.xml and validator-rules.xml files as well as dtd file
We had also tried using relative path using
<!DOCTYPE form-validation SYSTEM
"/WEB-INF/validator_1_3_0.dtd">
and also tried using
<!DOCTYPE form-validation SYSTEM
"validator_1_3_0.dtd">
But it is taking base path from where the application is getting started It gives following error when I start like this
11:50:33,318 ERROR [org.apache.struts.validator.ValidatorPlugIn] (ServerService Thread Pool -- 97) <path_to_application_startup_dir>/WEB-INF/validator_1_3_0.dtd (No such file or directory): java.io.FileNotFoundException: <path_to_application_startup_dir>/WEB-INF/validator_1_3_0.dtd (No such file or directory)
But it all works good when I load dtd file from local using absolute path like this
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3.0//EN"
"file:///<path_to_application>/src/main/webapp/WEB-INF/validator_1_3_0.dtd">
How do I resolve my error and parse tags as required either using relative path ( as absolute path will change for every system ) or using some other URL ?
Note - I am using java 21 and wildfly 32 in my application
Expected behaviour - DTD file should be resolved hence giving no errors for xml element not parseable
Upvotes: 0
Views: 49