org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/Iroom-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.addAnnotatedClass(Ljava/lang/Class;)Lorg/hibernate/cfg/Configuration;

Stack Overflow | user2078883 | 1 week ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to poroszd . Or join the community to write better ones.
  1. 0
    samebug tip
    You need to deploy aspectJ (aspectjweaver.jar) together with your application. Add it to your pom.xml
  2. 0

    org.springframework.beans.factory.BeanCreationException:org.springframework.beans.factory.BeanCreationException: Error creating bean

    Stack Overflow | 2 years ago | Salini
    org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.news.dao.UserDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.addAnnotatedClass(Ljava/lang/Class;)Lorg/hibernate/cfg/Configuration;
  3. 0

    hibernate error on spring project

    Stack Overflow | 3 years ago | Housseminfo
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [file:/C:/Users/housseminfo/workspace/ERP_PCD/target/classes/META-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.addAnnotatedClass(Ljava/lang/Class;)Lorg/hibernate/cfg/Configuration;
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Getting error NoClassDefFoundError after upgradting to Spring 3.2.4

    Stack Overflow | 3 years ago | user1636585
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/eam/deploy/tfcc-admin.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/context/CurrentSessionContext
  6. 0

    hibernate 4 and spring 3.1.2 issue with LocalSessionFactoryBuilder

    Coderanch | 4 years ago | fabian verbeek
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/hibernate-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springframework.orm .hibernate4.LocalSessionFactoryBuilder at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory. initializeBean(AbstractAutowireCapableBeanFactory.java:1455) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .createBean(AbstractAutowireCapableBeanFactory.java:456)

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NoSuchMethodError

      org.hibernate.cfg.Configuration.addAnnotatedClass(Ljava/lang/Class;)Lorg/hibernate/cfg/Configuration;

      at org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.postProcessMappings()
    2. Hibernate
      AbstractSessionFactoryBean.afterPropertiesSet
      1. org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.postProcessMappings(AnnotationSessionFactoryBean.java:155)
      2. org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:657)
      3. org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:189)
      3 frames
    3. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
      2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
      3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
      4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      5. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      6. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      7. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      8. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      9. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736)
      9 frames
    4. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
      2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
      2 frames
    5. Spring MVC
      HttpServletBean.init
      1. org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663)
      2. org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629)
      3. org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677)
      4. org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548)
      5. org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489)
      6. org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
      6 frames
    6. JavaServlet
      GenericServlet.init
      1. javax.servlet.GenericServlet.init(GenericServlet.java:158)
      1 frame
    7. Glassfish Core
      ContainerBase$StartChild.call
      1. org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
      2. org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
      3. org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
      4. org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
      5. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
      6. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      7. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
      8. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
      8 frames
    8. Java RT
      Thread.run
      1. java.util.concurrent.FutureTask.run(Unknown Source)
      2. java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      3. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      4. java.lang.Thread.run(Unknown Source)
      4 frames