[jboss-user] [JBoss Seam] - Embedded EJB Testing Woes

mwkohout do-not-reply at jboss.com
Tue Aug 21 14:53:44 EDT 2007


I'm trying to use the embedded EJB container for testing a seam 2.0 seam-gen based app but am having problems.


I've got a datasource set up as so:

  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |             xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
  |             xmlns="urn:jboss:bean-deployer">
  | 
  |    <bean name="ICTRCoreDatasourceBootstrap"
  |         class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
  |       <property name="driverClass">com.mysql.jdbc.Driver</property>
  |       <property name="connectionURL">jdbc:mysql://de01.gcrc.umn.edu/mwkohout_ictrcore</property>
  |       <property name="userName">mwkohout</property>
  |       <property name="password">password</property>
  |       <property name="jndiName">java:/ICTRCoreDatasource</property>
  |       <property name="minSize">0</property>
  |       <property name="maxSize">10</property>
  |       <property name="blockingTimeout">1000</property>
  |       <property name="idleTimeout">100000</property>
  |       <property name="transactionManager">
  |         <inject bean="TransactionManager"/>
  |       </property>
  |       <property name="cachedConnectionManager">
  |         <inject bean="CachedConnectionManager"/>
  |       </property>
  |       <property name="initialContextProperties">
  |         <inject bean="InitialContextProperties"/>
  |       </property>
  |    </bean>
  | 
  |    <bean name="ICTRCoreDatasource" class="java.lang.Object">
  |       <constructor factoryMethod="getDatasource">
  |          <factory bean="ICTRCoreDatasourceBootstrap"/>
  |       </constructor>
  |    </bean>
  | 
  | </deployment>
  | 
It's living in test-build/META-INF/

and I've got a PU set up like so:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <!-- Persistence deployment descriptor for dev profile -->
  | <persistence xmlns="http://java.sun.com/xml/ns/persistence" 
  |              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |              xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
  |              version="1.0">
  |              
  |    <persistence-unit name="ICTRCore">
  |       <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |       <jta-data-source>java:/ICTRCoreDatasource</jta-data-source>
  |       <properties>
  |          <property name="hibernate.hbm2ddl.auto" value="update"/>
  |          <property name="hibernate.cache.use_query_cache" value="true"/>
  |          <property name="hibernate.show_sql" value="true"/>
  |          <property name="jboss.entity.manager.factory.jndi.name" value="java:/ICTRCoreEntityManagerFactory"/>
  |       </properties>
  |    </persistence-unit>
  |     
  | </persistence>
  | 
It lives in the test-build/META-INF dir as well.

But I'm getting this error:

  | INFO  21-08 13:46:47,955  [org.hibernate.cfg.annotations.EntityBinder.bindTable():340] Bind entity edu.umn.ictr.authentication.Role on table Role
  | INFO  21-08 13:46:47,999  [org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass():581] Mapping collection: edu.umn.ictr.IRBInterface.IrbStudy.studyActions -> STUDY_ACTION
  | INFO  21-08 13:46:48,000  [org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass():581] Mapping collection: edu.umn.ictr.IRBInterface.IrbStudy.studyFundings -> STUDY_FUNDING
  | INFO  21-08 13:46:48,000  [org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass():581] Mapping collection: edu.umn.ictr.IRBInterface.IrbStudy.studyTitles -> STUDY_TITLE
  | INFO  21-08 13:46:48,003  [org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass():581] Mapping collection: edu.umn.ictr.IRBInterface.IrbStudy.studyPersons -> STUDY_PERSONNEL
  | INFO  21-08 13:46:48,120  [org.hibernate.util.NamingHelper.getInitialContext():26] JNDI InitialContext properties:{}
  | FATAL 21-08 13:46:48,141  [org.hibernate.connection.DatasourceConnectionProvider.configure():55] Could not find datasource: java:/ICTRCoreDatasource
  | javax.naming.NameNotFoundException: ICTRCoreDatasource not bound
  |         at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
  |         at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
  |         at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
  |         at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
  |         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:628)
  |         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
  |         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:2006)
  |         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289)
  |         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
  |         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 edu.umn.ictr.core.test.entity.UserTest.init(UserTest.java:52)
  |         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: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.TestNG.privateMain(TestNG.java:824)
  |         at org.testng.TestNG.main(TestNG.java:802)
  | 
  | ===============================================
  | Suite1
  | Total tests run: 1, Failures: 0, Skips: 1
  | Configuration Failures: 2, Skips: 2
  | ===============================================
  | 

What am I missing?  Is there any obvious errors I'm making?

thanks
Mike Kohout




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076453#4076453

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076453



More information about the jboss-user mailing list