Hi Denis,
I have first update in CVS for EAR deployment it works for this case:
1. Create Seam project in EAR deployment
2. Create for or action for created project
3. Select test xml from test project and run it by Run As/TestNG Suite
test shoud pass now without errors.
Awsome ;)
Any changes needed in the seamgen related files ?
Now I'm finishing te WAR configuration, need to do:
Setup Web App Libraries as Exported in web projeject to fix tests
compilation error.
ok.
After I have it there will be a problem with datasource.xml (see
below).
Any Ideas how to fix it?
Peter - can you step in here and come with suggestions to where the
datasource should be when running tests on war's (in this case there are
no EJB/EAR....where would one put it then ?
Or does this actually require a different persistence.xml with
hibernate.connection properties ?
Denis - have you looked in how seam-gen runs tests for wars ?
/max
12:40:23,421 WARN [Ejb3Configuration] Overriding
hibernate.transaction.factory_class is dangerous, this might break the
EJB3 specification implementation
12:40:23,515 INFO [NamingHelper] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
12:40:23,515 FATAL [DatasourceConnectionProvider] Could not find
datasource: java:/testweb56Datasource
javax.naming.NameNotFoundException: testweb56Datasource not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:626)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
at javax.naming.InitialContext.lookup(Unknown Source)
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:61)
at
org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
at
org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:151)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:205)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
at
org.jboss.seam.core.EntityManagerFactory.startup(EntityManagerFactory.java:74)
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.jboss.seam.util.Reflections.invoke(Reflections.java:20)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
at org.jboss.seam.Component.callComponentMethod(Component.java:1842)
at org.jboss.seam.Component.callCreateMethod(Component.java:1757)
at org.jboss.seam.Component.newInstance(Component.java:1746)
at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
at
org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:145)
at org.jboss.seam.init.Initialization.init(Initialization.java:504)
at org.jboss.seam.mock.SeamTest.init(SeamTest.java:701)
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.invokeConfigurationMethod(Invoker.java:394)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
at
org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
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)
FAILED CONFIGURATION: @BeforeClass init
javax.persistence.PersistenceException:
org.hibernate.HibernateException: Could not find datasource
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:217)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
at
org.jboss.seam.core.EntityManagerFactory.startup(EntityManagerFactory.java:74)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
at org.jboss.seam.Component.callComponentMethod(Component.java:1842)
at org.jboss.seam.Component.callCreateMethod(Component.java:1757)
at org.jboss.seam.Component.newInstance(Component.java:1746)
at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
at
org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:145)
at org.jboss.seam.init.Initialization.init(Initialization.java:504)
at org.jboss.seam.mock.SeamTest.init(SeamTest.java:701)
Caused by: org.hibernate.HibernateException: Could not find datasource
at
org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
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:61)
at
org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
at
org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:151)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:205)
... 38 more
Caused by: javax.naming.NameNotFoundException: testweb56Datasource not
bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:626)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
at javax.naming.InitialContext.lookup(Unknown Source)
at
org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
... 47 more
... Removed 26 stack frames
SKIPPED CONFIGURATION: @BeforeMethod begin
SKIPPED CONFIGURATION: @AfterMethod end
SKIPPED CONFIGURATION: @AfterClass cleanup
SKIPPED: test
Thanks
Denis
Max Rydahl Andersen wrote:
>
>>
http://jira.jboss.com/jira/browse/JBIDE-906 - Create TestNG project
>> for Seam
>> Project created in the same configuration as seam-gen does: with
>> components.properties for Web and test projects. Web project has
>> enbedded-ejb disabled, test vice versa.
>> I'd say it fixed, but some configuration issues with class path
>> should be fixed
>
> fyi - I got a greenlight testng run now after some twiddling.
>
> I'm still investigating *exactly* why these tweaks are needed and if
> they have any effect other places but in short it is:
>
> 1) On web project only jboss-seam.jar is exposed on the classpath need
> to add the remaining jars in project properties/J2ee Module dependencies
> (this makes drools/security issues go away). This modifies manfiest.mf
> which might effect how jboss 4.2 load classes so need to investigate
> if this should work or not.
>
> 2) Reorder the exported classpath on test to have the ear/ejb/war
> project at the *end* so the *-all.jar takes effect (this removes the
> weird NPE's which is probably caused by a mix of
> jbossxb/microcontainer from jboss 4.2 and the embedded ejb)
>
> 3) JarArchiveBrowser can't handle spaces so if your workspace is in
> c:/Document Settings/yadayda then you will get more weird errors. Move
> it to e.g. c:/rhdevstudio/workspace to make it work)
>
> The bad news is that it feels very fragile having these very different
> jars, but i guess that's life in JEE java ;(
>
> In any case the good news is that these are all explainable and
> fixable things.
>
> The extra good news is that all of the guys who have worked on these
> libs/jars will be in Neuchatel next week so they can buy me a beer or
> get beaten with a stick ;)
>
> /max
>