Hello,
I am trying to use the library apache.commons.validator 1.3.1 with jsf2.
Also I have the library oro 2.0.8 because I saw that it is necesary.
I have done a lot of diferents tests but I always have the same problem:
When the application try to run this line:
EmailValidator instance = EmailValidator.getInstance();
Always get the same exception:
java.lang.NoClassDefFoundError: org/apache/commons/validator/EmailValidator
at bc.portal.validations.MailValidation.validate(MailValidation.java:20)
at javax.faces.component.UIInput.validateValue(UIInput.java:1127)
at javax.faces.component.UIInput.validate(UIInput.java:941)...
I show you the code:
@FacesValidator(value = "mailValidator")
public class MailValidation implements Validator {
@Override
public void validate(FacesContext facesContext, UIComponent component, Object object) throws ValidatorException {
EmailValidator instance = EmailValidator.getInstance();
if(!instance.isValid(object.toString())){
FacesMessage facesMessage = new FacesMessage("Invalid email address");
throw new ValidatorException(facesMessage);
}
}
}
And the xhtml code:
<h:outputLabel value="#{msg['register.mail']}"/>
<h:inputText value="#{registerBean.profile.mail}" id="mail">
<f:validator validatorId="mailValidator"/>
</h:inputText>
<h:message id="mailErrorMessage" for="mail" style="color:red;" />
I cannot find the reason for this error. Anybody had had the same problem?
Thank you very much in advance :)
[Message sent by forum member 'alex1712']
http://forums.java.net/jive/thread.jspa?messageID=474836