-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Unit Testing Exception OneToMany.orphanRemoval()Z
PostPosted: Wed Dec 07, 2011 11:13 am 
Newbie

Joined: Sun Feb 15, 2009 8:24 am
Posts: 9
Hi everyone,
I have a web application spring + hibernate based and it run/works well. But when I try to test it via unit test, I got the "Caused by: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z" this exception. I read a lot of about this problem, all people say it come due to JPA1 and place JPA2 on your classpath. But I don't have any JPA1 based jar on my classpath yet hibernate's own provided JPA2 but still get the exception.

My Library stack is following,

Hibernate 3.6.8
-hibernate3.jar
-hibernate-jpa-2.0-api-1.0.1.Final.jar
-hibernate-testing.jar
-antlr-2.7.6.jar
-commons-collections-3.1.jar
-dom4j-1.6.1.jar
- javassist-3.12.0.GA.jar
-jta-1.1.jar
-slf4j-api-1.6.1.jar
-commons-logging-1.1.1.jar

Spring Libraries 3.0.6
-org.springframework.aop;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
-org.springframework.asm;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
-org.springframework.aspects;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
-org.springframework.beans;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.context;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.context.support;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.core;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.expression;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.jdbc;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.jms;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.orm;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.oxm;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.transaction;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.web;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.web.servlet;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- org.springframework.web.portlet;version="[3.0.6.RELEASE, 3.0.6.RELEASE]",
- com.springsource.org.aopalliance;version="[1.0.0, 1.0.0]"

My Unit Test Code, very simple


Code:

@ContextConfiguration( locations = {"classpath:spring/applicationContext.xml" } )
public class RegistrationServiceTest extends AbstractJUnit4SpringContextTests {
   
   @Autowired
   RegisterationSerivce serivce;
   
   @Test
   public void getRegistrationRefData() {
      List list =  serivce.getAllCustomers( );
      System.out.println(list.size( ));
   }
}




I would be great thankful for any help in this regard.

_________________
Faisal Basra


Top
 Profile  
 
 Post subject: Re: Unit Testing Exception OneToMany.orphanRemoval()Z
PostPosted: Thu Dec 08, 2011 3:31 am 
Newbie

Joined: Sun Feb 15, 2009 8:24 am
Posts: 9
I just solved the fucking issue... it was due to "Java EE 5 Libraries" which contains following libraries.

-javaee.jar
-jsf-impl.jar
-jsf-api.jar
-jstl-1.2.jar

I am using Myeclipse Enterprise Workbench 9.0 which automatically adds "Java EE 5 Libraries" to every web project. So incase of JPA & JSF you want to use custom libraries, we must remove them.

_________________
Faisal Basra


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.