Pergunta

hope you can help me out with this problem, i have a web apps(JSF 2.0) in eclipse helios, i have created a class that uses apache.commons.validator because i need to validate a Url and some IPs addresses, everything compiles just find a launch it quite nicely but when it ccame the time to actually use the UrlValidator

java.lang.NoClassDefFoundError: org/apache/commons/validator/UrlValidator
at com.outboundfactory.bean.validator.UrlConverter.getAsObject(UrlConverter.java:34)
at com.icesoft.faces.renderkit.dom_html_basic.BaseRenderer.getConvertedValue(BaseRenderer.java:91)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1023)
at javax.faces.component.UIInput.validate(UIInput.java:953)

So a workaround that i found is to put the jakarta-oro and the apache-commons-validator into tomcat libs directly but thats no a solution either. Does anyone know if there is a special configuration to put the libs in Eclipse.

Here is a shot of how i have configured it enter image description here

Foi útil?

Solução

I you're using maven then mvn eclipse:eclipse will add in the jars.

Outras dicas

you might try to add the external jars directly to the project build path instead of the general java build path. Right click on the project folder --> Build Path --> configure build path.

In a webapp, 3rd party JAR's needs to be placed in /WEB-INF/lib folder. No further actions needs to be take place. If it's a Dynamic Web Project, Eclipse will take care about them automagically.

Don't forget to undo the mess in build path. Remove the libraries you manually added there as external JARs from local disk file system while they belonged in /WEB-INF/lib folder.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top