java.lang.NoClassDefFoundError: javax/transaction/Synchronization

Spring JIRA | Brad Armstrong | 7 years ago
  1. 0

    When starting up the Petclinic example on Tomcat 6.x using the OpenJPA provider this error is encountered. ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed> org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in ServletContext resource [/WEB-INF/spring/applicationContext-jpa.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring/applicationContext-jpa.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/Synchronization at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:671) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:401) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261) The issue is with the pom.xml configuration. By default the javax.transaction dependency is configured to only be available in the test scope. But when using OpenJPA, this is actually needed at runtime. So the dependency should be configured as: <dependency> <groupId>javax.transaction</groupId> <artifactId>com.springsource.javax.transaction</artifactId> <version>1.1.0</version> </dependency>

    Spring JIRA | 7 years ago | Brad Armstrong
    java.lang.NoClassDefFoundError: javax/transaction/Synchronization
  2. 0

    When starting up the Petclinic example on Tomcat 6.x using the OpenJPA provider this error is encountered. ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed> org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in ServletContext resource [/WEB-INF/spring/applicationContext-jpa.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring/applicationContext-jpa.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/Synchronization at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:671) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:401) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261) The issue is with the pom.xml configuration. By default the javax.transaction dependency is configured to only be available in the test scope. But when using OpenJPA, this is actually needed at runtime. So the dependency should be configured as: <dependency> <groupId>javax.transaction</groupId> <artifactId>com.springsource.javax.transaction</artifactId> <version>1.1.0</version> </dependency>

    Spring JIRA | 7 years ago | Brad Armstrong
    java.lang.NoClassDefFoundError: javax/transaction/Synchronization
  3. 0

    JPA configured app with Spring annotations

    Stack Overflow | 2 years ago
    java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring에서 ehcache 설정 시 오류 문의 합니다.

    Google Groups | 7 years ago | gomoosin
    java.lang.NoClassDefFoundError: org/springframework/metadata/Attributes
  6. 0

    java 测试 - GeneralYY0的专栏 - 博客频道 - CSDN.NET

    csdn.net | 5 months ago
    java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented

  1. linxiaolong 1 times, last 4 months ago
4 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.NoClassDefFoundError

    javax/transaction/Synchronization

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean()
  2. Spring Beans
    AbstractBeanFactory.getBean
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    3. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
    4. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    5. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
    6. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    6 frames
  3. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:671)
    2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:401)
    2 frames
  4. Spring
    ContextLoader.createWebApplicationContext
    1. org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
    1 frame