-
1. Re: TestNG entityMnager question
pmuir Dec 2, 2007 9:21 AM (in response to dkane)Make sure resources is on the test classpath.
-
2. Re: TestNG entityMnager question
dkane Dec 2, 2007 9:34 AM (in response to dkane)"pete.muir@jboss.org" wrote:
Make sure resources is on the test classpath.
Yes, they are in Run.. , "Classpath" tab here
http://testng.org/pictures/launch.png
The same output. -
3. Re: TestNG entityMnager question
pmuir Dec 2, 2007 9:38 AM (in response to dkane)Sorry, didn't read your post carefully. I don't see why you need to init the entity manager in the Java SE fashion if you are using SeamTest.
-
4. Re: TestNG entityMnager question
dkane Dec 2, 2007 10:13 AM (in response to dkane)I need to test Seam component that uses EntityManager. My test is based on "Simplicity and power beyond Java EE" book example :
public class HelloWorldTest extends SeamTest { @Test public void unitTestSayHello() throws Exception { Manager manager = new ManagerAction (); EntityManagerFactory emf = Persistence.createEntityManagerFactory("helloworld"); EntityManager em = emf.createEntityManager(); setField(manager, "em", em); Person person = new Person (); person.setName ("Thomas Heute"); setField(manager, "person", person); setField(manager, "confirmed", false);
The only difference in my case is initializing EntityManager in @BeforeClass method to use it in different @Test methods then.
What is incorrect ? -
5. Re: TestNG entityMnager question
dkane Dec 2, 2007 10:16 AM (in response to dkane)"dkane" wrote:
The only difference in my case is initializing EntityManager in @BeforeClass method to use it in different @Test methods then.
Moving that to @Test method does not help, BTW. -
6. Re: TestNG entityMnager question
dkane Dec 2, 2007 10:48 AM (in response to dkane)Solved by adding hibernate-entitymanager.jar to classpath , thanks to guide :
http://dewarim.de/wms/error/no_persistence_provider_for_entitymanager
It is rather difficut to collect necessary jars for TestNG + Seam, I must say. No documentation found so far. -
7. Re: TestNG entityMnager question
dkane Dec 2, 2007 11:04 AM (in response to dkane)Now getting
java.lang.ExceptionInInitializerError at org.hibernate.cfg.Configuration.reset(Configuration.java:168) at org.hibernate.cfg.AnnotationConfiguration.reset(AnnotationConfiguration.java:211) at org.hibernate.cfg.Configuration.<init>(Configuration.java:187) at org.hibernate.cfg.Configuration.<init>(Configuration.java:191) at org.hibernate.cfg.AnnotationConfiguration.<init>(AnnotationConfiguration.java:87) at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:105) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:119) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33) at com.avtohouse.test.SimpleSearchCase.simpleSearch(SimpleSearchCase.java:22) Caused by: java.lang.NullPointerException at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:144) at org.hibernate.cfg.Environment.<clinit>(Environment.java:529) ... 32 more ... Removed 22 stack frames
no idea what is still missing -
8. Re: TestNG entityMnager question
dkane Dec 2, 2007 4:27 PM (in response to dkane)And, the final result for today :)
java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationConfiguration.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager; at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:152) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:186) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:246) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33) at com.avtohouse.test.SimpleSearchCase.simpleSearch(SimpleSearchCase.java:22) ... Removed 22 stack frames
This is being thrown from lineEntityManagerFactory emf = Persistence.createEntityManagerFactory("trackUnit");
-
9. Re: TestNG entityMnager question
sushmu Dec 21, 2007 2:20 AM (in response to dkane)Make sure EntityManager and Annotations versions are aligned.
For example, 3.2.1.GA version for both annotatios and entity manager in the jboss maven repository would fix the exception you are getting.