If this is a client (running in a separate process from JBoss) you won't 
be able to do this: JDBC connections and datasources aren't serializable 
and can't be accessed accross process boundaries.

Nikhil Patil wrote:

> 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