2011-07-28

Usage of Android' / GWT' RequestFactory without providing hibernate-validator.jar aka get rid of "Unable to initialize a JSR 303 Bean Validator"


Jul 28, 2011 9:50:57 AM com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer <clinit>INFO: Unable to initialize a JSR 303 Bean Validatorjavax.validation.ValidationException: Unable to find a default provider at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264) at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111) at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.<clinit>(ReflectiveServiceLayer.java:60) at com.google.web.bindery.requestfactory.server.ServiceLayer.create(ServiceLayer.java:74) at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.<init>(RequestFactoryServlet.java:88) at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.<init>(RequestFactoryServlet.java:74)

First of all: If you don't actually use validation, you don't need the hibernate-validator.jar at all. ...ok, except to get rid of the above "INFO" message? There is also a more resource-efficient way to get rid of this message.

Just put

.level = WARNING 

in a fille called logging.properties that you can put into your project's src folder. Afterwards you have to add

-Djava.util.logging.config.file=/Users/alex/my/project/Verp/src/logging.properties

to your VM parameters when calling GWT or a JUnit Test which is using the RequestFactory.