Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

net.sf.hibernate.MappingException: could not instantiate id generator

 
Nagendra Batchu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i am new to Hibernate.
I am trying to get the current session from the HibernateSessionFactory. I am getting following exception.
Could any one kindly help me in this?
%%%% Error Creating SessionFactory %%%%
net.sf.hibernate.MappingException: could not instantiate id generator
at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:82)
at net.sf.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:82)
at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:644)
at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:690)
at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:805)
at com.rm.juno.chequepayments.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:50)
at com.rm.juno.chequepayments.server.dao.ChequePaymentsHibernateDAO.fetchTransactionListForChqPrinting(ChequePaymentsHibernateDAO.java:334)
at com.rm.juno.chequepayments.server.br.ChequePaymentsBaseBR.fetchTransactionListForChqPrinting(ChequePaymentsBaseBR.java:1063)
at com.rm.juno.chequepayments.server.br.ChequePaymentsBaseBR.fetchDataChqForPrintingTab(ChequePaymentsBaseBR.java:831)
at com.rm.juno.chequepayments.server.stub.ChequePaymentsStub.fetchDataChqForPrintingTab(ChequePaymentsStub.java:181)
at com.rm.juno.chequepayments.web.delegate.ChequePaymentsDelegate.fetchDataChqForPrintingTab(ChequePaymentsDelegate.java:141)
at com.rm.juno.chequepayments.web.action.ChequePaymentsAction.processShowChequesForPrinting(ChequePaymentsAction.java:546)
at com.rm.juno.chequepayments.web.action.ChequePaymentsAction.showChequesForPrinting(ChequePaymentsAction.java:525)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.rm.juno.JunoFilter.doFilter(JunoFilter.java:140)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:76)
... 43 more

thanks in advance for help.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using Hibernate 2? Its very old.
 
Nagendra Batchu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently working on hibernate POC. I am trying to convert one of the our existing module to use hibernate.
I am just taking the help from following examples http://www.laliluna.de/struts-hibernate-integration-tutorial-en.html.

Cann't we proceed with hibernate2? Is this error is specific to version?


thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error you are seeing is a ClassNotFoundException, so its not specific to Hibernate2, it happens when the ClassLoader tries to load a class throuhg its string name and the class is not on the classpath.

The tutorial you are using uses Hibernate3. Hibernate2 is very old, which is no reason in itself not to use it (though its is not nearly as feature rich as Hibernate3), however one significant change from 2 to 3 is a wholesale refactoring of the package structure. So the class names and the mappings shown in that tutorial will not work with Hibernate2. If you are looking to learn Hibernate, learn the latest version.
 
Nagendra Batchu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul.

Thanks for your information.
I am still in initial stage of my work (POC). So, let me change the version now itself and see whether this error still persist.!!!

Could you suggest any site or technical stuff related to steps involved in incorporating hibernate into existing project(module)?

Any related information would be great helpful.

thanks a lot.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing springs to mind. I would recommend learning Hibernate in isolation before trying to integrate. But assuming your existing application has a DAO layer it should be fairly simple to swap one persistance technology for another.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic