I'm using maven and not seam-gen. I have a simple entity User and a unit test.
I'm referring Seam 2.0 examples in the test creation. Here's the snippets: UserTest: public class UserTest | extends SeamTest | { | EntityManager em() { | EntityManagerFactory emf = Persistence.createEntityManagerFactory("intellidocs"); | EntityManager em = emf.createEntityManager(); | assertNotNull("entity manager", em); | assertTrue("entity manager open", em.isOpen()); | return em; | } persistence.xml <persistence-unit name="intellidocs"> | <jta-data-source>java:/intellidocsDS</jta-data-source> | pgsql-ds.xml <datasources> | <local-tx-datasource> | | <!-- The jndi name of the DataSource, it is prefixed with java:/ --> | <!-- Datasources are not available outside the virtual machine --> | <jndi-name>intellidocsDS</jndi-name> | | <connection-url>jdbc:postgresql://localhost:5432/test</connection-url> | | <!-- The driver class --> | <driver-class>org.postgresql.Driver</driver-class> | | All of them are present in test/resources. I run mvn:test and here's the error: ------------------------------------------------------- | T E S T S | ------------------------------------------------------- | Running com.ibt.intellidocs.dummy.UserTest | 12:20:55,752 INFO Version:15 - Hibernate EntityManager 3.2.1.GA | 12:20:55,777 INFO Version:15 - Hibernate Annotations 3.2.1.GA | 12:20:55,794 INFO Environment:509 - Hibernate 3.2.3 | 12:20:55,802 INFO Environment:542 - hibernate.properties not found | 12:20:55,807 INFO Environment:676 - Bytecode provider name : cglib | 12:20:55,815 INFO Environment:593 - using JDK 1.4 java.sql.Timestamp handling | 12:20:56,697 INFO AnnotationBinder:388 - Binding entity from annotated class: com.ibt.intellidocs.dummy.User | 12:20:56,757 INFO EntityBinder:378 - Bind entity com.ibt.intellidocs.dummy.User on table DUMMYUSER | 12:20:56,960 INFO NamingHelper:26 - JNDI InitialContext properties:{} | 12:20:56,966 INFO MemoryContextFactory:34 - Creating EJB3Unit initial JNDI context | 12:20:56,972 FATAL DatasourceConnectionProvider:55 - Could not find datasource: java:/intellidocsDS | javax.naming.NamingException: Can't find the name (intellidocsDS) in the JNDI tree Current bindings>({}) | at com.bm.jndi.MemoryContext.lookup(MemoryContext.java:38) | at javax.naming.InitialContext.lookup(InitialContext.java:392) | at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52) | at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124) | at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29) | at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62) | at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009) | at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292) | at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713) | at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121) | at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83) | at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60) | at com.ibt.intellidocs.dummy.UserTest.em(UserTest.java:21) | at com.ibt.intellidocs.dummy.UserTest.testRequiredAttributes(UserTest.java:50) | at com.ibt.intellidocs.dummy.UserTest$1.testComponents(UserTest.java:37) | at org.jboss.seam.mock.BaseSeamTest$ComponentTest.run(BaseSeamTest.java:167) | at com.ibt.intellidocs.dummy.UserTest.runTests(UserTest.java:32) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:597) | at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:552) | at org.testng.internal.Invoker.invokeMethod(Invoker.java:407) | at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:778) | at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105) | at org.testng.TestRunner.privateRun(TestRunner.java:682) | at org.testng.TestRunner.run(TestRunner.java:566) | at org.testng.SuiteRunner.privateRun(SuiteRunner.java:220) | at org.testng.SuiteRunner.run(SuiteRunner.java:146) | at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:713) | at org.testng.TestNG.runSuitesLocally(TestNG.java:676) | at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeTestNG(TestNGDirectoryTestSuite.java:195) | at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:133) | at org.apache.maven.surefire.Surefire.run(Surefire.java:132) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:597) | at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:308) | at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:879) | 12:20:57,040 INFO AnnotationBinder:388 - Binding entity from annotated class: com.ibt.intellidocs.dummy.User | 12:20:57,041 INFO EntityBinder:378 - Bind entity com.ibt.intellidocs.dummy.User on table DUMMYUSER | 12:20:57,060 INFO NamingHelper:26 - JNDI InitialContext properties:{} | 12:20:57,062 FATAL DatasourceConnectionProvider:55 - Could not find datasource: java:/intellidocsDS | Now the question.. How do I make the datasource available to SeamTest through JNDI? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114892#4114892 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114892 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user