14 Replies Latest reply on Dec 7, 2012 8:15 AM by Israel Lacerra

    "Unable to instantiate custom type: org.hibernate.type.EnumType" in JBoss 7.2.Alpha1-SNAPSHOT

    Israel Lacerra Newbie

      Guys,

       

      I'm trying to migrate my app from a JBoss 4.2 server to the JBoss 7.

       

      Using JBoss 7.1.1 Final I was stuck in a exception like this:

       

      22:03:05,981 ERROR [org.jboss.as.controller.management-operation] (HttpManagementService-threads - 3) JBAS014612: Operation ("deploy") failed - address: ([("deployment" => "earProject-1.0-SNAPSHOT.ear")]): java.lang.StringIndexOutOfBoundsException: String index out of range: -5

          at java.lang.String.substring(String.java:1937) [classes.jar:1.6.0_24]

          at java.lang.String.substring(String.java:1904) [classes.jar:1.6.0_24]

          at org.jboss.as.jpa.hibernate4.management.HibernateStatisticsResource.getCacheRegionNames(HibernateStatisticsResource.java:319)

          at org.jboss.as.jpa.hibernate4.management.HibernateStatisticsResource.getChildren(HibernateStatisticsResource.java:200)

       

       

       

      So, I updated the hibernate libs to the last version and I start to get this exception:

       

      12:02:47,352 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 70) MSC00001: Failed to start service jboss.persistenceunit."rosys-core.ear/rosys-core.jar#rosys": org.jboss.msc.service.StartException in service jboss.persistenceunit."rosys-core.ear/rosys-core.jar#rosys": javax.persistence.PersistenceException: [PersistenceUnit: rosys] Unable to build EntityManagerFactory

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:100)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

          at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: rosys] Unable to build EntityManagerFactory

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)

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

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:197)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$500(PersistenceUnitServiceImpl.java:57)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:96)

          ... 4 more

      Caused by: org.hibernate.MappingException: Unable to instantiate custom type: org.hibernate.type.EnumType

          at org.hibernate.type.TypeFactory.custom(TypeFactory.java:193)

          at org.hibernate.type.TypeFactory.custom(TypeFactory.java:179)

          at org.hibernate.type.TypeFactory.byClass(TypeFactory.java:103)

          at org.hibernate.type.TypeResolver.heuristicType(TypeResolver.java:130)

          at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:307)

          at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:294)

          at org.hibernate.mapping.Property.isValid(Property.java:238)

          at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:469)

          at org.hibernate.mapping.RootClass.validate(RootClass.java:270)

          at org.hibernate.cfg.Configuration.validate(Configuration.java:1294)

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1738)

          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)

          ... 9 more

      Caused by: java.lang.ClassCastException: class java.lang.String

          at java.lang.Class.asSubclass(Class.java:3018) [rt.jar:1.6.0_26]

          at org.hibernate.type.EnumType.setParameterValues(EnumType.java:178)

          at org.hibernate.type.TypeFactory.injectParameters(TypeFactory.java:131)

          at org.hibernate.type.TypeFactory.custom(TypeFactory.java:189)

          ... 21 more

       

       

      I tried the the last nightly build version of JBoss, and I get this same exception. Anyone has any tips about the error in JBoss 7.1.1 or this last error with the last JBoss snapshot?? My persistence.xml is attached...

       

      thanks!