[jboss-user] [JBoss Seam] - configuration question

laksu do-not-reply at jboss.com
Fri Dec 7 11:54:27 EST 2007


Hi,
I have a 1.2.1 working project that I am trying to migrate to 2.0.0 GA.
To avoid issues with testng configuration I have started with a fresh seam-gen generated template."seam setup", "seam new project", "seam explode"
I copied my classes and pages into it. I left Glassfish aside for the time being, again to avoid configuration issues and converted to JBoss AS.
Due to some bug (http://jira.jboss.org/jira/browse/JBSEAM-2220) I decided to convert to annotations and leave hbm.xml configuration. I have a few mapping issues there because of this conversion but the whole thing is almost working.
Note that I use Hibernate for persistence instead of JPA and I had to have some modifications on top of the seam-gen generated template like preventing persistence.xml to be copied to the build etc.
Now, back to testing again I have a problem with configuration. This is probably due to my lack of knowledge about the embedded container and I cannot figure out a correct recipe from the examples, info provided in the manual and "seam-gen"erated project combined.
So I need your help:
Here follows my latest configuration files:
components.xml:
    <core:init debug="@debug@" jndi-pattern="@jndiPattern@" />
  |     
  |     <core:manager concurrent-request-timeout="500" 
  |                   conversation-timeout="120000" 
  |                   conversation-id-parameter="cid"/>
  |     
  |     <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
  |     <persistence:managed-hibernate-session name="hibernateSession"
  |                                            auto-create="true"
  |                                            session-factory-jndi-name="java:/payrollSessionFactory"/>
  |     
  |     <persistence:hibernate-transaction session="#{hibernateSession}"/>
  |     
  |     
payroll-test-ds
<?xml version="1.0" encoding="UTF-8"?>
  | 
  | <!DOCTYPE datasources
  | PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
  | "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
  | 
  | <datasources>
  |     
  |     <local-tx-datasource>
  |         <jndi-name>payrollDatasource</jndi-name>
  |         <connection-url>jdbc:postgresql://192.168.10.79:5432/payroll_levent</connection-url>
  |         <driver-class>org.postgresql.Driver</driver-class>
  |         <user-name>postgres</user-name>
  |         <password>postgres</password>
  |         <metadata>
  |             <type-mapping>PostgreSQL 8.0</type-mapping>
  |         </metadata>      
  |         <new-connection-sql>select 1</new-connection-sql>
  |         <check-valid-connection-sql>select 1</check-valid-connection-sql>
  | 
  |     </local-tx-datasource>
  | </datasources>
  | 
I obviously have a missing link there deploying the payroll-test-ds.xml to the embedded container. Because I get the following:

   [testng] FAILED CONFIGURATION: @BeforeClass init
  |    [testng] org.hibernate.HibernateException: Could not find datasource
  |    [testng]     at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
  |    [testng]     at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
  |    [testng]     at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
  |    [testng]     at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:397)
  |    [testng]     at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
  |    [testng]     at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006)
  |    [testng]     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289)
  |    [testng]     at org.jboss.seam.persistence.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:165)
  |    [testng]     at org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateSessionFactory.java:79)
  |    [testng]     at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
  |    [testng]     at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
  |    [testng]     at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
  |    [testng]     at org.jboss.seam.Component.callCreateMethod(Component.java:1997)
  |    [testng]     at org.jboss.seam.Component.newInstance(Component.java:1968)
  |    [testng]     at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
  |    [testng]     at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
  |    [testng]     at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
  |    [testng]     at org.jboss.seam.init.Initialization.init(Initialization.java:555)
  |    [testng]     at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:939)
  |    [testng]     at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
  |    [testng] Caused by: javax.naming.NameNotFoundException: payrollDatasource not bound
  |    [testng]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
  |    [testng]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
  |    [testng]     at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
  |    [testng]     at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
  |    [testng]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:628)
  |    [testng]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
  |    [testng]     at javax.naming.InitialContext.lookup(InitialContext.java:351)
  |    [testng]     at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
  |    [testng]     ... 45 more
  |    [testng] ... Removed 26 stack frames
  | 

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

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



More information about the jboss-user mailing list