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

HibernateDaoSupport Runtime Exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • jboss-fuse-6.2.1, jboss-fuse-6.3
    • Hibernate, Karaf
    • None
    • % %
    • Hide

      (create mysql or other database, edit database configuration in src/main/resources/hibernate.cfg.xml)

      Build reproducer:
      mvn clean install

      Install driver, features and reproducer bundle:
      osgi:install -s mvn:mysql/mysql-connector-java/5.1.39
      features:install jdbc hibernate spring-jdbc spring-orm camel-spring
      osgi:install -s mvn:com.redhat.examples/sample-hibernate/1.0.0-SNAPSHOT

      Show
      (create mysql or other database, edit database configuration in src/main/resources/hibernate.cfg.xml) Build reproducer: mvn clean install Install driver, features and reproducer bundle: osgi:install -s mvn:mysql/mysql-connector-java/5.1.39 features:install jdbc hibernate spring-jdbc spring-orm camel-spring osgi:install -s mvn:com.redhat.examples/sample-hibernate/1.0.0-SNAPSHOT

      HibernateDaoSupport, provided by spring-orm (org.apache.servicemix.bundles.spring-orm-3.2.12.RELEASE_2) in the Fuse 6.2.1 container, is located in hibernate3 package "org.springframework.orm.hibernate3.support.HibernateDaoSupport". HibernateDaoSupport uses "org.springframework.orm.hibernate3.SessionFactoryUtil"s, which expects to receive a org.hibernate.classic.Session. The container provides a hibernate4 "org.hibernate.Session" (no classic), which leads to a runtime error:

      Caused by: java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session;
      	at org.springframework.orm.hibernate3.SessionFactoryUtils.doGetSession(SessionFactoryUtils.java:321)[293:org.apache.servicemix.bundles.spring-orm:3.2.12.RELEASE_2]
      	at org.springframework.orm.hibernate3.SessionFactoryUtils.getSession(SessionFactoryUtils.java:233)[293:org.apache.servicemix.bundles.spring-orm:3.2.12.RELEASE_2]
      	at org.springframework.orm.hibernate3.HibernateTemplate.getSession(HibernateTemplate.java:458)[293:org.apache.servicemix.bundles.spring-orm:3.2.12.RELEASE_2]
      	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:393)[293:org.apache.servicemix.bundles.spring-orm:3.2.12.RELEASE_2]
      	at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:375)[293:org.apache.servicemix.bundles.spring-orm:3.2.12.RELEASE_2]
      	at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:684)[293:org.apache.servicemix.bundles.spring-orm:3.2.12.RELEASE_2]
      	at com.redhat.examples.HibernateDAO.save(HibernateDAO.java:12)[294:sample-hibernate:1.0.0.SNAPSHOT]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_79]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_79]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79]
      	at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79]
      	at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)
      	at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)
      	at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)
      	... 16 more
      

              ggrzybek Grzegorz Grzybek
              rhn-support-shiggs Stephen Higgs
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: