Я получаю ошибку ниже при развертывании моего проекта в Tomcat 7. Я использую Struts 1.1 и Commons-validator 1.3.1, компилируя с JDK 7.
java.lang.NoSuchMethodError: org.apache. struts.validator.FieldChecks.validateRequired (Ljava / языки / объекта; Lorg / Apache / обыкновенные / валидатор / ValidatorAction; Lorg / Apache / обыкновенные / валидатор / поле; Lorg / Apache / распорки / действие / ActionErrors; Ljavax / сервлет / HTTP /HttpServletRequest;) Z в org.apache.struts.util.StrutsValidator.validateRequired (StrutsValidator.java:114) в sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) в sun.reflect.NativeOmpпо адресу) в org.apache.commons.validator.Field.validateForRule (Field.java:796) в org.apache.commons.validator.Field.validate (Field.java:876) в org.apache.commons.validator.Form.validate (Form.java:288) в org.apache.commons.validator.Validator.validate (Validator.java:351) в org.apache.struts.validator.ValidatorForm.validate (ValidatorForm.java:116) в com.mj.metal.form.administration.SignInForm.validate (SignInForm.java:158) в org.apache.struts.action.RequestProcessor.processValidate (RequestProcessoror.java: 945) в org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:198) в org.apache.struts.action.ActionServlet.process (ActionServlet.java:1913) в org.apache.struts. action.ActionServlet.doGet (ActionServlet.java:449) в javax.servlet.http.HttpServlet.service (HttpServlet.java:624) в javax.servlet.http.HttpServlet.service (HttpServlet.java: 7: 7.catalina.core. ng.Thread.run (Thread.java:748)
ниже - мой validator-rules.xml
<global>
<validator name="required" classname="org.apache.struts.util.StrutsValidator" method="validateRequired" methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest" msg="errors.required">
<javascript>
<![CDATA[
function validateRequired(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oRequired = new required();
for (x in oRequired) {
if ((form[oRequired[x][0]].type == 'text' ||
form[oRequired[x][0]].type == 'textarea' ||
form[oRequired[x][0]].type == 'select-one' ||
form[oRequired[x][0]].type == 'radio' ||
form[oRequired[x][0]].type == 'password') &&
(form[oRequired[x][0]].value == '')) {
if (i == 0) {
focusField = form[oRequired[x][0]];
}
fields[i++] = oRequired[x][1];
bValid = false;
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return bValid;
}]]>
</javascript>
</validator>
<validator name="requiredif" classname="org.apache.struts.validator.FieldChecks" method="validateRequiredIf" methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest" msg="errors.required" />
<validator name="validwhen" msg="errors.required" classname="org.apache.struts.validator.validwhen.ValidWhen" method="validateValidWhen" methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest" />
<validator name="minlength" classname="org.apache.struts.util.StrutsValidator" method="validateMinLength" methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest" depends="required" msg="errors.minlength">
<javascript>
<![CDATA[
function validateMinLength(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMinLength = new minlength();
for (x in oMinLength) {
if (form[oMinLength[x][0]].type == 'text' ||
form[oMinLength[x][0]].type == 'textarea') {
var iMin = parseInt(oMinLength[x][2]("minlength"));
if (!(form[oMinLength[x][0]].value.length >= iMin)) {
if (i == 0) {
focusField = form[oMinLength[x][0]];
}
fields[i++] = oMinLength[x][1];
bValid = false;
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return bValid;
}]]>
</javascript>
</validator>
...