[jboss-user] [JBoss Seam] - jndi datasource publishing

hstang do-not-reply at jboss.com
Sun Dec 17 13:15:58 EST 2006


Hi, I'm new to Seam.  I have a current interest to integrate Spring and Seam's data access strategy.  However, I am unable to lookup the data source from JNDI using embedded ejb3 + SEAM configuration.  I am using the "jpa" example from SEAM 1.1.0GA.

My log reports:
12:40:46,196 [main] INFO DataSourceFactory:43 - starting Datasource at JNDI name: java:/DefaultDS
  | 12:40:46,216 [main] INFO LocalTxDataSource:102 - Bound datasource to JNDI name 'java:/DefaultDS'
  | 

However in my application, the only keys in the initial context are those listed in the jndi.properties, namely java.naming.factory.initial and java.naming.factory.url.pkgs.

  | #jndi.properties
  | java.naming.factory.initial org.jnp.interfaces.LocalOnlyContextFactory
  | java.naming.factory.url.pkgs org.jboss.naming:org.jnp.interfaces
  | 

I have crawled through the Seam's source and there is only one place that initializes the jndi properties--Initialization.java, that's after reading in jndi.properties which makes sense.

So now I'm looking at org.jboss.seam.microcontainer.DataSourceFactory:

  |  // ds is of type LocalTxDataSource
  |  ds.setJndiName(jndiName);
  |  ds.setInitialContextProperties(Naming.getInitialContextProperties());
  | 

What does the code above do?  I mean Seam is able to find the datasouce in my specified jndiName=java:/DefaultDS.  However, in my application and in Spring, it could not find "DefaultDS" in the initial context.  

Is it possible to bind the data source created by the microcontainer to JNDI in Seam?  Thanks.

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

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



More information about the jboss-user mailing list