[JBoss-user] [EJB/JBoss] - JNDI and DataSources

2005-01-05 Thread ajaykrishnan
I have successfully bound a DataSource to the naming service:
[WrapperDataSourceService] Bound connection factory for resource adapter for 
ConnectionManager 'jboss.jca:name=MySqlDS,service=DataSourceBinding to JNDI 
name 'java:MySqlDS'

Objects from applications deployed within the Application Server are able to 
look this up properly using:

  | private String initialContextFactory = 
org.jnp.interfaces.NamingContextFactory;
  | 
  | private String url = localhost:1099;
  | 
  | private String namingFactoryURLPackages = 
org.jboss.naming:org.jnp.interfaces;
  | 
  | private String principal = ;
  | 
  | private String credentials = ;
  | 
  | public AbstractJndiLocator() throws ServiceLocatorException {
  | env = new Properties();
  | env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
initialContextFactory);
  | env.setProperty(Context.PROVIDER_URL, url);
  | env.setProperty(Context.URL_PKG_PREFIXES, 
namingFactoryURLPackages);
  | //  env.put(Context.SECURITY_PRINCIPAL, principal);
  | //  env.put(Context.SECURITY_CREDENTIALS, credentials);
  | try {
  | ctx = new InitialContext(env);
  | //  ctx = new InitialContext();
  | } catch (NamingException e) {
  | throw new ServiceLocatorException(Unable to create 
AbstractJndiLocator;  + e.getMessage(), e);
  | }
  | }
  | 
  | /**
  |  * If this returns null, caller should deal with it
  |  */
  | public Object lookup(String name) throws NamingException {
  | System.out.println(NAME +   + ctx.getNameInNamespace());
  | 
  | 
  | 
  | to java:MySqlDS. My understanding is that any application should now be 
able to look this DataSource up given the correct InitialContext.

View the original post : 
http://www.jboss.org/index.html?module=bbop=viewtopicp=3860813#3860813

Reply to the post : 
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3860813


---
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB/JBoss] - JNDI and DataSources

2005-01-05 Thread ajaykrishnan
I have successfully bound a DataSource to the naming service:
[WrapperDataSourceService] Bound connection factory for resource adapter for 
ConnectionManager 'jboss.jca:name=MySqlDS,service=DataSourceBinding to JNDI 
name 'java:MySqlDS'

Objects deployed in the Application Server are able to look this up using:

  | private String initialContextFactory = 
org.jnp.interfaces.NamingContextFactory;
  | private String url = localhost:1099;
  | private String namingFactoryURLPackages = 
org.jboss.naming:org.jnp.interfaces;
  | 
  | env = new Properties();
  | env.setProperty(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
  | env.setProperty(Context.PROVIDER_URL, url);
  | env.setProperty(Context.URL_PKG_PREFIXES, namingFactoryURLPackages);
  | try {
  | ctx = new InitialContext(env);
  | Object o = ctx.lookup(java:MySqlDS);
  | } catch (NamingException e) {
  |//
  | }
  | }
  | 

I am now writing JUnit test cases; these objects are not deployed into the 
Application Server. When I use the same code to lookup java:MySqlDS I receive a 
NamingException. When I list all bindings, none are found. 

It seems I'm missing something conceptually... based on what I know there 
should be no difference between objects deployed / outside the Application 
Server and how they interact with the naming service.

Thanks in advance.

View the original post : 
http://www.jboss.org/index.html?module=bbop=viewtopicp=3860815#3860815

Reply to the post : 
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3860815


---
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user