Announcement Announcement Module
Collapse
No announcement yet.
org.hibernate.MappingException: could not instantiate id generator Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.hibernate.MappingException: could not instantiate id generator

    Hi all,

    I'm using java 1.5, hibernate 3.0, springframework 2.0., mysql 5.0., tomcat 5.5.
    it is really strange, since there is no problem for me to run junit test....but when i deploy to tomcat, there is hibernate.MappingException caused by could not instantiate id generator.

    In hbm.xml file, the id setting is like below:

    <id name="id" column="ID" type="java.lang.String" >
    <meta attribute="field-description">
    @hibernate.id
    generator-class="uuid.string"
    type="java.lang.String"
    column="ID"
    </meta>
    <generator class="uuid" />
    </id>

    Any idea or suggestion for me? thanks a lot!


    Error message from tomcat server:
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'efitnessSess
    ionFactory' defined in ServletContext resource [/WEB-INF/applicationContext-hibernate.xml]: Invocati
    on of init method failed; nested exception is org.hibernate.MappingException: could not instantiate
    id generator
    Caused by: org.hibernate.MappingException: could not instantiate id generator
    at org.hibernate.id.IdentifierGeneratorFactory.create (IdentifierGeneratorFactory.java:98)
    at org.hibernate.mapping.SimpleValue.createIdentifier Generator(SimpleValue.java:152)
    at org.hibernate.impl.SessionFactoryImpl.<init>(Sessi onFactoryImpl.java:192)
    at org.hibernate.cfg.Configuration.buildSessionFactor y(Configuration.java:1218)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.newSessionFactory(LocalSession
    FactoryBean.java:807)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.buildSessionFactory(LocalSessi
    onFactoryBean.java:740)
    at org.springframework.orm.hibernate3.AbstractSession FactoryBean.afterPropertiesSet(Abstract
    SessionFactoryBean.java:131)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMe
    thods(AbstractAutowireCapableBeanFactory.java:1062 )
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBe
    an(AbstractAutowireCapableBeanFactory.java:1029)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(A
    bstractAutowireCapableBeanFactory.java:420)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFac
    tory.java:245)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(Defau
    ltSingletonBeanRegistry.java:141)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory
    .java:242)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory
    .java:156)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingle
    tons(DefaultListableBeanFactory.java:287)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicatio
    nContext.java:348)
    at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(
    AbstractRefreshableWebApplicationContext.java:156)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.j
    ava:246)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.jav
    a:184)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderLis
    tener.java:49)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3729)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4187)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:759)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:739)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:524)
    at org.apache.catalina.startup.HostConfig.deployDirec tory(HostConfig.java:904)
    at org.apache.catalina.startup.HostConfig.deployDirec tories(HostConfig.java:867)
    at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:474)
    at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1122)
    at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:310)
    at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1021)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1013)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:442)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:450)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:709)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:551)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:294)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:432)
    Caused by: org.hibernate.MappingException: could not interpret id generator strategy: uuid.string
    at org.hibernate.id.IdentifierGeneratorFactory.getIde ntifierGeneratorClass(IdentifierGenerat
    orFactory.java:109)
    at org.hibernate.id.IdentifierGeneratorFactory.create (IdentifierGeneratorFactory.java:92)
    ... 43 more
    14.11.2006 09:30:55 org.apache.catalina.core.StandardContext start
    SCHWERWIEGEND: Error listenerStart
    14.11.2006 09:30:55 org.apache.catalina.core.StandardContext start
    SCHWERWIEGEND: Context [/efitness] startup failed due to previous errors

  • #2
    The generator class is defined as uuid but the field-description also defines a generator-class, should you really be doing it twice? The actual problem though, seems to be that it doesn't know about a generator class called uuid.string.
    Last edited by karldmoore; Nov 14th, 2006, 03:13 AM.

    Comment


    • #3
      sorry, please see clearly, I'm using uuid, not uuid.string ( I forgot to delete the meta data)

      Comment


      • #4
        Check this out.
        http://forum.hibernate.org/viewtopic...b722fe4475494c

        Comment


        • #5
          sorry.....it's my fault.....
          i don't there is some problems during deployment.
          the old hbm.xml is not updated......
          yes...the old hbm.xml is using uuid.string.....
          and i know hibernate 3 does not support any uuid.string or uuid.hex anymore......

          Comment

          Working...
          X