Try precluding the data source name with "java:/", that is, try 
javax.sql.DataSource source =
(javax.sql.DataSource)jndiContext.lookup("java:/defaultDS");

I believe I had that problem in the past and that fixed it.

Cheers,

Eric

-----Original Message-----
From: Nikhil Patil [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 3:26 PM
To: jboss
Subject: [JBoss-user] JNDI Lookup of Datasources


Hi
I have set a datasource called "workflowDS" in JBOSS. I am trying to do a
client lookup from a client and this how my code looks like.

        Properties env = new Properties();
      env.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
      env.setProperty("java.naming.provider.url",  "localhost:1099");

      try
      {
            // Get a naming context
            InitialContext jndiContext = new InitialContext(env);
            System.out.println("Got context");
                javax.sql.DataSource source =
(javax.sql.DataSource)jndiContext.lookup("defaultDS");

      }
      catch(Exception e)
      {
         System.out.println(e.toString());
      }

I get a NameNotFoundException. Any reason. I know that workflowDS is getting
bound to the jndi tree for the console says so.

Thanks
Nikhil


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to