3 Replies Latest reply on Oct 2, 2007 5:35 PM by shimi

    Standalone JNDI server using jnpserver.jar

    bakarirum

      I have successfully configured a JNP server using and was able to add objects to the context. In one example, I added a Commons DBCP connection pool class into the context. I was able to take the same JVM and retrieve this reference and use it successfully. However, when I access the DataSource object using another JVM instance, the connection pool returns null on the ds.getConnection() method. The code successfully gives me a reference to the DataSource object (that is not null), but for some reason the "pool" reference in the DataSource object is null. Below is the client code used to retrieve the object. Please let me know if you need more information. All other "basic" type objects such as String and Integer are successfully read. I am only having the problem with the DataSource object.

      Thank you for taking time to read my post.

      Marc

       Hashtable<String,String> env = new Hashtable<String,String>();
       env.put(Context.PROVIDER_URL,"jnp://localhost:1099");
       env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
       env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
       context = null;
       try {
       context = new InitialContext(env);
       } catch (NamingException ex) {
       ex.printStackTrace();
       System.exit(-1);
      
       }
       DataSource ds = (DataSource) context.lookup("myenvironmentname");
       Connection conn = ds.getConnection();