Announcement Announcement Module
Collapse
No announcement yet.
NoSuchMethodError: javax/persistence/OneToMany.orphanRemoval()Z Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoSuchMethodError: javax/persistence/OneToMany.orphanRemoval()Z

    I am having problems running my unit tests within Rational Application Developer. It looks to me like some class path issue, but I can seem to get the right jars in place. Currenlt I have the following jars:

    antlr-2.7.6.jar
    cglib-nodep-2.2.jar
    commons-collections-3.1.jar
    commons-logging-1.1.1.jar
    dom4j-1.6.1.jar
    hibernate-jpa-2.0-api-1.0.0.Final.jar
    hibernate3.jar
    javassist-3.9.0.GA.jar
    jta-1.1.jar
    log4j-1.2.5.jar
    org.springframework.aop-3.0.4.RELEASE.jar
    org.springframework.asm-3.0.4.RELEASE.jar
    org.springframework.beans-3.0.1.RELEASE-A.jar
    org.springframework.context-3.0.4.RELEASE.jar
    org.springframework.core-3.0.4.RELEASE.jar
    org.springframework.expression-3.0.4.RELEASE.jar
    org.springframework.jdbc-3.0.4.RELEASE.jar
    org.springframework.jms-3.0.4.RELEASE.jar
    org.springframework.orm-3.0.4.RELEASE.jar
    org.springframework.test-3.0.4.RELEASE.jar
    org.springframework.transaction-3.0.4.RELEASE.jar
    org.springframework.web-3.0.4.RELEASE.jar
    org.springframework.web.servlet-3.0.1.RELEASE-A.jar
    slf4j-api-1.5.8.jar
    slf4j-log4j12-1.5.8.jar
    wicket-1.4.7.jar
    wicket-auth-roles-1.4.7.jar
    wicket-datetime-1.4.7.jar
    wicket-devutils-1.4.7.jar
    wicket-extensions-1.4.7.jar
    wicket-guice-1.4.7.jar
    wicket-ioc-1.4.7.jar
    wicket-jmx-1.4.7.jar
    wicket-objectsizeof-agent-1.4.7.jar
    wicket-spring-1.4.7.jar
    wicket-velocity-1.4.7.jar
    junit-4.8.1.jar
    commons-dbcp-1.4.jar

    And here is the error I am encountering:


    java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:308)
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.injectDependencies (DependencyInjectionTestExecutionListener.java:109 )
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.prepareTestInstanc e(DependencyInjectionTestExecutionListener.java:75 )
    at org.springframework.test.context.TestContextManage r.prepareTestInstance(TestContextManager.java:333)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.createTest(SpringJUnit4ClassRunner.j ava:220)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner$1.runReflectiveCall(SpringJUnit4Clas sRunner.java:301)
    at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.methodBlock(SpringJUnit4ClassRunner. java:303)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:240)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner. java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRu nner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRu nner.java:184)
    at org.springframework.test.context.junit4.statements .RunBeforeTestClassCallbacks.evaluate(RunBeforeTes tClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements .RunAfterTestClassCallbacks.evaluate(RunAfterTestC lassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.ja va:236)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.run(SpringJUnit4ClassRunner.java:180 )
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:45)
    at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in URL [file:test/resources/test-app-config.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/OneToMany.orphanRemoval()Z
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1403)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:450)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 90)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:287 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:189)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:545)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:84)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:1)
    at org.springframework.test.context.TestContext.loadA pplicationContext(TestContext.java:280)
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:304)
    ... 24 more
    Caused by: java.lang.NoSuchMethodError: javax/persistence/OneToMany.orphanRemoval()Z
    at org.hibernate.cfg.AnnotationBinder.processElementA nnotations(AnnotationBinder.java:1745)
    at org.hibernate.cfg.AnnotationBinder.processIdProper tiesIfNotAlready(AnnotationBinder.java:738)
    at org.hibernate.cfg.AnnotationBinder.bindClass(Annot ationBinder.java:702)
    at org.hibernate.cfg.AnnotationConfiguration.processA rtifactsOfType(AnnotationConfiguration.java:631)
    at org.hibernate.cfg.AnnotationConfiguration.secondPa ssCompile(AnnotationConfiguration.java:352)
    at org.hibernate.cfg.Configuration.buildMappings(Conf iguration.java:1206)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.buildSessionFactory(LocalSessionFactoryBe an.java:717)
    at org.springframework.orm.hibernate3.AbstractSession FactoryBean.afterPropertiesSet(AbstractSessionFact oryBean.java:211)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1460)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1400)
    ... 37 more

    I have read the following related posts:

    http://opensource.atlassian.com/proj...rowse/HHH-4955
    https://forum.hibernate.org/viewtopic.php?f=1&t=1003996

    but can't seem to figure my way around this problem.

    Any help would greatly be appreciated


    Regards,


    Steven H.

  • #2
    Steven

    Use code tags, are more readable for us

    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in URL [file:test/resources/test-app-config.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/OneToMany.orphanRemoval()Z
    You have a missing jar ejb3-persistence.jar available in \hibernate-annotations-3.4.0.GA\lib

    According to your links some problem exists with such jar, let us know your advance

    Comment


    • #3
      Fix may be in using Class-Path line in manifest file

      Originally posted by sheadley View Post
      I am having problems running my unit tests within Rational Application Developer. It looks to me like some class path issue, but I can seem to get the right jars in place. Currenlt I have the following jars:

      antlr-2.7.6.jar
      cglib-nodep-2.2.jar
      commons-collections-3.1.jar
      commons-logging-1.1.1.jar
      dom4j-1.6.1.jar
      hibernate-jpa-2.0-api-1.0.0.Final.jar
      hibernate3.jar
      ...
      junit-4.8.1.jar
      commons-dbcp-1.4.jar

      And here is the error I am encountering:


      java.lang.IllegalStateException: Failed to load ApplicationContext
      at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:308)
      ...
      name 'sessionFactory' defined in URL [file:test/resources/test-app-config.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/OneToMany.orphanRemoval()Z
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1403)
      ...

      I have read the following related posts:

      http://opensource.atlassian.com/proj...rowse/HHH-4955
      https://forum.hibernate.org/viewtopic.php?f=1&t=1003996

      but can't seem to figure my way around this problem.
      Ran into a similar problem. Don't know if it helps with JUnit tests but it did for me with deployed apps. I posted the answer at:

      http://stackoverflow.com/questions/3...84204#12584204

      Comment

      Working...
      X