Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-2223

Hibernate with Spring-ORM cannot load an application table class in Fuse 6.1

XMLWordPrintable

    • % %
    • Hide

      1. Download, unpack, and build the attached test-as-bundle.zip to produce test-0.0.1.jar
      2. Start Fuse 6.1. In the console do:

      features:install jpa-hibernate
      features:install spring-orm
      osig:install file:///path/to/test-0.0.1.jar
      start

      {test_bundle_number}

      You will see an exception indicating that the application class com.blabla.hibernate.TestTable cannot be loaded.

      Show
      1. Download, unpack, and build the attached test-as-bundle.zip to produce test-0.0.1.jar 2. Start Fuse 6.1. In the console do: features:install jpa-hibernate features:install spring-orm osig:install file:///path/to/test-0.0.1.jar start {test_bundle_number} You will see an exception indicating that the application class com.blabla.hibernate.TestTable cannot be loaded.

      An application that uses Hibernate and Spring-ORM in Fuse fails because Hibernate cannot load a class in the application code that models a database table. This class is defined in an XML file and is therefore, presumably, passed by name to Hibernate. A workaround is to execute "dynamic-import" on the hibernate-core bundle.

      Exception in thread "SpringOsgiExtenderThread-2" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [bundle://271.0:0/META-INF/spring/bundle-context.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: entity class not found: com.blabla.hibernate.TestTable
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
              ...
      
      Caused by: org.hibernate.MappingException: entity class not found: com.blabla.hibernate.TestTable
      	at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:137)
      	at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:390)
      	at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:75)
      	at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:145)
              ...
      
      Caused by: java.lang.ClassNotFoundException: com.blabla.hibernate.TestTable not found by org.hibernate.core [266]
      	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
      	at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
      	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:190)
      	at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:192)
      	at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:132)
      

              Unassigned Unassigned
              rhn-support-kboone Kevin Boone
              Tomas Plevko Tomas Plevko
              Votes:
              1 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: