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.