File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes Using Hibernate 3.4 in JBoss 5.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Using Hibernate 3.4 in JBoss 5.1" Watch "Using Hibernate 3.4 in JBoss 5.1" New topic

Using Hibernate 3.4 in JBoss 5.1

Sam Tsang

Joined: Mar 26, 2009
Posts: 5
I've come across some problems using Hibernate 3.4 on JBoss 5.1.
Hibernate 3.4 is a JPA 1.0 implementation so it should be fine to be used in JBoss 5.1. The thing is JBoss has its own version of Hibernate, which is located at /common/lib whereas I don't want to use the version provided by JBoss. What I did is that I removed the hibernate-annotations.jar, hibernate-commons-annotations.jar, hibernate-core.jar, hibernate-entitymanager.jar, hibernate-jmx.jar and hibernate-validator.jar from that folder and put my Hibernate 3.4 jars into server/default/lib directory. I also compiled hibernate-validator.jar 3.1.0 into my war file because it seems otherwise JBoss cannot recognize where the validator is. After I have done all the above, I packaged my war file and deployed it to the deploy folder.

The server started with no issue. But when I tried to access my web application it throws an error:

2010-10-27 10:55:13,416 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] (http- Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/app/uncaughtException]
javax.servlet.ServletException: Servlet.init() for servlet roodummy threw exception
at org.apache.catalina.core.StandardWrapper.loadServlet(
at org.apache.catalina.core.StandardWrapper.allocate(
at org.apache.catalina.core.ApplicationDispatcher.invoke(
at org.apache.catalina.core.ApplicationDispatcher.processRequest(
at org.apache.catalina.core.ApplicationDispatcher.doForward(
at org.apache.catalina.core.ApplicationDispatcher.forward(
at org.apache.catalina.core.StandardHostValve.custom(
at org.apache.catalina.core.StandardHostValve.throwable(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to find a default provider
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(
at org.springframework.web.servlet.FrameworkServlet.initServletBean(
at org.springframework.web.servlet.HttpServletBean.init(
at javax.servlet.GenericServlet.init(
at org.apache.catalina.core.StandardWrapper.loadServlet(
... 16 more
Caused by: javax.validation.ValidationException: Unable to find a default provider
at javax.validation.Validation$GenericBootstrapImpl.configure(
at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(
... 32 more

It looks like it still cannot find the validator. But it is already in the war file. What have I done wrong here?
Francesco Marchioni
Ranch Hand

Joined: Sep 22, 2003
Posts: 194
If you include (alone) the hibernate-validator.jar under the WEB-INF/lib you will have issues because Hibernate core classes are loaded from a different Classloader. What kind of error do you get when placing ALL Hibernate jars under server/<yourserver>/lib ?

Enterprise Integration Tutorials - JBoss-WildFly Tutorials
I agree. Here's the link:
subject: Using Hibernate 3.4 in JBoss 5.1
It's not a secret anymore!