testing in pojo environment with eclipse
valbosoft Sep 18, 2007 6:45 AMHello,
I have a working seam application in eclipse, and I'm now trying to set a test.
No ejb is used. The application runs on tomcat from within eclipse.
When I run the test, Seam seems to start up ok, but I get the following error:
12:16:06,621 INFO [Environment] Hibernate 3.2.1 12:16:06,621 INFO [Environment] hibernate.properties not found 12:16:06,637 INFO [Environment] Bytecode provider name : cglib 12:16:06,668 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling 12:16:18,715 INFO [AnnotationBinder] Binding entity from annotated class: com.inmobiliaria.entity.Inmueble 12:16:18,824 INFO [EntityBinder] Bind entity com.inmobiliaria.entity.Inmueble on table Inmueble ... 12:16:19,496 INFO [NamingHelper] JNDI InitialContext properties:{} 12:16:19,574 ERROR [NamingHelper] Could not obtain initial context javax.naming.NamingException: Local server is not initialized at org.jnp.interfaces.LocalOnlyContextFactory.getInitialContext(LocalOnlyContextFactory.java:30) at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.init(Unknown Source) at javax.naming.InitialContext.<init>(Unknown Source) at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:28) 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:2006) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289) 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:51) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33) at com.inmobiliaria.test.PersonaTest.getEntityManager(PersonaTest.java:76) at com.inmobiliaria.test.PersonaTest.testRegisterAction(PersonaTest.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604) at org.testng.internal.Invoker.invokeMethod(Invoker.java:470) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:564) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:830) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.runWorkers(TestRunner.java:678) at org.testng.TestRunner.privateRun(TestRunner.java:624) at org.testng.TestRunner.run(TestRunner.java:495) at org.testng.SuiteRunner.runTest(SuiteRunner.java:300) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275) at org.testng.SuiteRunner.run(SuiteRunner.java:190) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792) at org.testng.TestNG.runSuitesLocally(TestNG.java:765) at org.testng.TestNG.run(TestNG.java:699) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122) 12:16:19,590 FATAL [DatasourceConnectionProvider] Could not find datasource: java:/DefaultDS
I guess the test environment cannot find the persistence.xml
Can anybody give a pointer on where I should place it? Or what else could be the cause?
I've tried several options: place it in src/WEB-INF, created a resources source directory with a WEB-INF directory, but no luck.
Regards, Bo