java.lang.ClassCastException: org.hibernate.type.SerializableType cannot be cast to org.hibernate.type.CustomType

tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Unable to deploy EAR with enum type mapped property (ClassCastException: SerializedType to CustomType)

    Stack Overflow | 5 months ago | Luis O. Mangioni
    java.lang.ClassCastException: org.hibernate.type.SerializableType cannot be cast to org.hibernate.type.CustomType

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.hibernate.type.SerializableType cannot be cast to org.hibernate.type.CustomType

      at org.hibernate.envers.configuration.internal.metadata.BasicMetadataGenerator.mapEnumerationType()
    2. org.hibernate.envers
      AdditionalJaxbMappingProducerImpl.produceAdditionalMappings
      1. org.hibernate.envers.configuration.internal.metadata.BasicMetadataGenerator.mapEnumerationType(BasicMetadataGenerator.java:112)
      2. org.hibernate.envers.configuration.internal.metadata.BasicMetadataGenerator.addBasic(BasicMetadataGenerator.java:64)
      3. org.hibernate.envers.configuration.internal.metadata.AuditMetadataGenerator.addValueInFirstPass(AuditMetadataGenerator.java:223)
      4. org.hibernate.envers.configuration.internal.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerator.java:348)
      5. org.hibernate.envers.configuration.internal.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGenerator.java:382)
      6. org.hibernate.envers.configuration.internal.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:687)
      7. org.hibernate.envers.configuration.internal.EntitiesConfigurator.configure(EntitiesConfigurator.java:95)
      8. org.hibernate.envers.boot.internal.EnversServiceImpl.doInitialize(EnversServiceImpl.java:154)
      9. org.hibernate.envers.boot.internal.EnversServiceImpl.initialize(EnversServiceImpl.java:118)
      10. org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl.produceAdditionalMappings(AdditionalJaxbMappingProducerImpl.java:99)
      10 frames
    3. org.hibernate.boot
      MetadataBuildingProcess.complete
      1. org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:288)
      1 frame
    4. org.hibernate.jpa
      HibernatePersistenceProvider.createContainerEntityManagerFactory
      1. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847)
      2. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874)
      3. org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:151)
      3 frames
    5. Embedded GlassFish Web
      JPADeployer.prepare
      1. org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199)
      2. org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)
      3. org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
      4. org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
      5. org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
      6. org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
      6 frames
    6. Kernel Classes
      ApplicationLifecycle.prepareModule
      1. com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925)
      1 frame
    7. Deployment Related JavaEE Full Profile Classes
      EarDeployer.prepare
      1. org.glassfish.javaee.full.deployment.EarDeployer.prepareBundle(EarDeployer.java:309)
      2. org.glassfish.javaee.full.deployment.EarDeployer.access$200(EarDeployer.java:88)
      3. org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:155)
      4. org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:152)
      5. org.glassfish.javaee.full.deployment.EarDeployer.doOnAllBundles(EarDeployer.java:255)
      6. org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:152)
      6 frames
    8. Kernel Classes
      ApplicationLifecycle.deploy
      1. com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925)
      2. com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434)
      3. com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
      3 frames
    9. Embedded GlassFish Web
      DeployCommand.execute
      1. org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
      1 frame
    10. Kernel Classes
      CommandRunnerImpl$2$1.run
      1. com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
      2. com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
      2 frames
    11. Java RT
      Subject.doAs
      1. java.security.AccessController.doPrivileged(Native Method)
      2. javax.security.auth.Subject.doAs(Subject.java:360)
      2 frames
    12. Kernel Classes
      CommandRunnerImpl$3.run
      1. com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
      2. com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
      3. com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
      3 frames
    13. Java RT
      Subject.doAs
      1. java.security.AccessController.doPrivileged(Native Method)
      2. javax.security.auth.Subject.doAs(Subject.java:360)
      2 frames
    14. Kernel Classes
      CommandRunnerImpl$ExecutionContext.execute
      1. com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
      2. com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
      3. com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
      4. com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
      5. com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
      5 frames
    15. org.glassfish.admin
      CommandResource.execCommandSimpInMultOut
      1. org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:404)
      2. org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
      2 frames
    16. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    17. jersey-core-server
      ServerRuntime$1.run
      1. org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      2. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
      3. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
      4. org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
      5. org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
      6. org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387)
      7. org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)
      8. org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103)
      9. org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:271)
      9 frames
    18. Jersey Core
      RequestScope.runInScope
      1. org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      2. org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      3. org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      4. org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      5. org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      6. org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297)
      6 frames
    19. jersey-core-server
      ApplicationHandler.handle
      1. org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254)
      2. org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028)
      2 frames
    20. jersey-container-grizzly2-http
      GrizzlyHttpContainer.service
      1. org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:365)
      1 frame
    21. GlassFish Admin
      RestAdapter.service
      1. org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:173)
      2. org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
      2 frames
    22. Kernel Classes
      ContainerMapper.service
      1. com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
      2. com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
      2 frames
    23. Grizzly Server
      HttpServerFilter.handleRead
      1. org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
      2. org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
      3. org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
      3 frames
    24. Grizzly
      AbstractThreadPool$Worker.run
      1. org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      2. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
      3. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
      4. org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
      5. org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      6. org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      7. org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
      8. org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      9. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      10. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      11. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      12. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
      13. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
      13 frames
    25. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)
      1 frame