org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.springframework.orm.hibernate4.SpringSessionContext]

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • If you try to deploy the application on JBoss 7 using the built-in hibernate, you got this stack trace: 15:32:46,919 ERROR [org.hibernate.internal.SessionFactoryImpl] (MSC service thread 1-1) HHH000302: Unable to construct current session context [org.springframework.orm.hibernate4.SpringSessionContext]: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.springframework.orm.hibernate4.SpringSessionContext] at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.internal.SessionFactoryImpl.buildCurrentSessionContext(SessionFactoryImpl.java:1491) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:502) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1784) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:242) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:372) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:357) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE] After digging the code it looks like that the spring initialized hibernate in a way that "hibernate.classLoader.application" property is not used. As result hibernate try to use local classloader for loading class defined in "hibernate.current_session_context_class"
    via by Maksym Gryevtsov,
  • If you try to deploy the application on JBoss 7 using the built-in hibernate, you got this stack trace: 15:32:46,919 ERROR [org.hibernate.internal.SessionFactoryImpl] (MSC service thread 1-1) HHH000302: Unable to construct current session context [org.springframework.orm.hibernate4.SpringSessionContext]: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.springframework.orm.hibernate4.SpringSessionContext] at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.internal.SessionFactoryImpl.buildCurrentSessionContext(SessionFactoryImpl.java:1491) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:502) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1784) [hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:242) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:372) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:357) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE] After digging the code it looks like that the spring initialized hibernate in a way that "hibernate.classLoader.application" property is not used. As result hibernate try to use local classloader for loading class defined in "hibernate.current_session_context_class"
    via by Maksym Gryevtsov,
  • Error 503 when using mysql
    via GitHub by enmaku
    ,
  • hibernate microsoft sql server crud
    via Stack Overflow by user1723988
    ,
  • GitHub comment 326#23684516
    via GitHub by enmaku
    ,
    • org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.springframework.orm.hibernate4.SpringSessionContext] at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141)[hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.internal.SessionFactoryImpl.buildCurrentSessionContext(SessionFactoryImpl.java:1491)[hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:502)[hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746)[hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1784)[hibernate-core-4.1.6.Final.jar:4.1.6.Final] at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:242)[spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:372)[spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:357)[spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]

    Users with the same issue

    regisso
    regisso1 times, last one,
    Unknown visitor1 times, last one,