4 Replies Latest reply on Dec 9, 2010 1:03 PM by gvalenc

    Can't find org.hibernate.id.IdentifierGenerationException

    gvalenc Newbie

      Caused by: java.lang.ClassNotFoundException: org.hibernate.id.IdentifierGenerationException
      at java.lang.Class.forNameImpl(Native Method)
      at java.lang.Class.forName(Class.java:172)
      at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:179)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1579)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1500)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1736)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1951)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1875)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1757)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1951)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1875)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1757)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1951)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1875)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1757)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:352)
      at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:238)
      at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:138)
      at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:123)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:1220)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:850)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
      at org.jboss.remoting.Client.invoke(Client.java:1724)
      at org.jboss.remoting.Client.invoke(Client.java:629)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
      at $Proxy3.invoke(Unknown Source)
      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
      at $Proxy2.createSubscription(Unknown Source)
      at com.venetica.vbr.client.res.RepoEventServices.subscribeToRepoItem(RepoEventServices.java:226)
      at com.venetica.vbr.res.ejb.director.test.RepoEventServicesTest.main(RepoEventServicesTest.java:86)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
      at $Proxy3.invoke(Unknown Source)
      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
      ... 3 more

      I'm on AS 5.1.0 GA. I'm getting a strange exception when trying to persist a POJO via a session bean. The bean is deployed in default config.

       

      Caused by: java.lang.ClassNotFoundException: org.hibernate.id.IdentifierGenerationException

      at java.lang.Class.forNameImpl(Native Method)

      at java.lang.Class.forName(Class.java:172)

      at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:179)

      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1579)

      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1500)

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1736)

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)

      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1951)

      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1875)

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1757)

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)

      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1951)

      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1875)

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1757)

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)

      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1951)

      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1875)

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1757)

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)

      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:352)

      at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:238)

      at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:138)

      at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:123)

      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:1220)

      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:850)

      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)

      at org.jboss.remoting.Client.invoke(Client.java:1724)

      at org.jboss.remoting.Client.invoke(Client.java:629)

      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)

      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)

      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

      at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)

      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)

      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

      at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)

      at $Proxy3.invoke(Unknown Source)

      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)

      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)

      at $Proxy2.createSubscription(Unknown Source)

      at ******************************(*********.java:226)

      at **********************************.main(****.java:86)

      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)

      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)

      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

      at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)

      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)

      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

      at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)

      at $Proxy3.invoke(Unknown Source)

      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)

      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)

      ... 3 more

       

      This class is definitely in JBOSS_HOME/common/lib/hibernate-core.jar. How can it not find this class?

        • 1. Re: Can't find org.hibernate.id.IdentifierGenerationException
          jaikiran pai Master

          The exception seems to be happening on the client side and not on the server. Are you invoking the bean from a remote JVM? Does the client have the hibernate jars in its classpath?

          • 2. Re: Can't find org.hibernate.id.IdentifierGenerationException
            gvalenc Newbie

            You are right. The exception is on the client side. I have jbossall-client.jar as usual on the client side. I wasn't aware I needed more. Do you have the docs on this handy so I know what I need to add specifically and under what scenarios?

            • 3. Re: Can't find org.hibernate.id.IdentifierGenerationException
              gvalenc Newbie

              I tried adding JBOSS_HOME/common/lib/hibernate-core.jar to the client class path and that solved it, though not sure if that's the appropriate way of doing it. However, I now get this:

               

              Caused by: javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short
              at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
              at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226)
              at org.jboss.jpa.tx.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:187)

              Caused by: javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short

              at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)

              at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226)

              at org.jboss.jpa.tx.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:187)

               

              The field I'm using as my primary key is a String, using varchar column def in the table with AUTO generated-value strategy. Is there a way to get Hibernate to select the appropriate generator? I tried adding a custom hbm.xml file but it complains about a duplicate mapping:

               

              09:35:18,671 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=MyApp.ear/myapp_director.jar#MyApp state=Create

              org.hibernate.DuplicateMappingException: Duplicate class/entity mapping ****

              at org.hibernate.cfg.Mappings.addClass(Mappings.java:141)

              at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:789)

              at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:546)

              at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)

              at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)

              at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)

              at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)

              at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)

              at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:425)

              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)

              at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:618)

              at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)

              at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)

              at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)

              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)

              at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)

              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)

              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)

              at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)

              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)

              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)

              at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)

              at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)

              at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)

              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)

              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)

              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)

              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)

              at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)

              at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)

              at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)

              at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)

              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)

              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)

              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)

              at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)

              at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)

              at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)

              at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:432)

              at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:295)

              at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:88)

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:165)

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:189)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:678)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:703)

              at java.lang.Thread.run(Thread.java:811)

              • 4. Re: Can't find org.hibernate.id.IdentifierGenerationException
                gvalenc Newbie

                I was only able to get this to work by changing the type of the key to an integer in the Java code unfortunately.