• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate exception

 
Ajay Dhar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am integrating Hibernate 3 with the Apache Commons Validation Framework so that the validation framework goes to the database to retrieve error messages.

I tested the Hibernate code in a servlet using a JNDI name for the datasource and it is working fine.

However, when I test the Hibernate code in the validation framework I get the following exception:

[4/25/11 14:25:35:026 EDT] 00000025 servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet Faces Servlet in application VTestEAR. Exception created : java.lang.NoClassDefFoundError: org.hibernate.type.TypeFactory (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:283)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:276)
at org.hibernate.mapping.Property.isValid(Property.java:207)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:458)
at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1149)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1334)
at us.ny.state.labor.framework.validation.dal.ValidationMessageDAO.getMessages(ValidationMessageDAO.java:22)
at us.ny.state.labor.framework.component.validation.impl.ApacheValidatorImpl.validate(ApacheValidatorImpl.java:199)
at us.ny.state.labor.jsf.phase.AbstractValidationListener.validatetest(AbstractValidationListener.java:221)
at us.ny.state.labor.jsf.phase.AbstractValidationListener.beforePhase(AbstractValidationListener.java:191)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1663)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1563)

I have checked the Hibernate jar and it does contain the class org.hibernate.type.TypeFactory.

When I run the code in debug mode, the exception is raised in the ValidationMessageDAO at the following line:



Here is my Hibernate configuration file:



If anyone could help out it would be greatly appreciated.

Thanks.
 
Ramon Anger
Ranch Hand
Posts: 56
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ajay,

you are sure you find that org.hibernate.type.TypeFactory.class only once in your classpath?

Cheers,
Ramon
 
Ajay Dhar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great suggestion.

I had the hiberanate3.jar in the lib directory of my web app and in the lib directory of a project reference. The referenced Java project is where I had my Hibernate code, and the web app called code from the referenced project. I removed the hibernate jar from the lib directory of the referenced project and just kept it in the classpath. After that it worked!

Thanks for your help Ramon!
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!