users@glassfish.java.net

Re: remote JNDI lookup (datasource)

From: <glassfish_at_javadesktop.org>
Date: Mon, 07 Jan 2008 12:52:46 PST

You should use Glassfish's naming provider instead of the Java SE CosNaming JNDI provider. CosNaming has at least a couple of issues. First, it's used to retrieve Corba or RMI-IIOP objects, not things like datasources. Second, even for retrieving RMI-IIOP objects such as Remote EJBs, it only works for the EJB 2.1 Remote view (not EJB 3.0) and even then does not allow you take advantage of the full capabilities of our ORB.

Our EJB FAQ has a number of entries that explain how to lookup Remote EJB 3.0 interfaces from various kinds of client runtimes. These all involve instantiating the appserver's naming provider, so you can use the same approach to acquire the Datasource. In your case, you'll need to either use the global JNDI name of the datasource since your client code is running outside of a Java EE component environment.

https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=252583