0 Replies Latest reply on Jul 25, 2002 2:08 AM by rajum

    DefaultDS not bound exception

    rajum

      Hi,
      I have created a connection pool in jboss.jcml with a pool name DefaultDS.
      Here is the jcml code :

      DefaultDS
      DefaultDS
      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl

      jdbc:weblogic:mssqlserver4:master@mdpdep106804
      1200000
      sa

      10
      false
      false
      false
      true
      120000
      1800000
      false
      false
      1.0
      0


      While starting the jboss server the connection pool is successfully created.
      I have written a small program which gets the connection.
      Here is the program:
      import java.sql.*;
      import java.util.*;
      import javax.naming.*;
      import javax.sql.DataSource;

      public class DataSourceTest
      {
      public static void main(String[] args)
      {
      try
      {
      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "localhost:1099");
      env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");

      Context ctx = new InitialContext(env);
      DataSource ds = null;

      try {
      ds = (DataSource) ctx.lookup("java:/DefaultDS");
      System.out.println("bound!!!!");
      }
      catch (Exception e) { e.printStackTrace(); }

      }
      catch (Exception e)
      {
      e.printStackTrace();
      }
      }
      }

      While executing this program it's throws following exception:

      javax.naming.NameNotFoundException: DefaultDS not bound
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
      RemoteCall.java:245)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
      220)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:435)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:419)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at DSTest.main(DSTest.java:22)

      D:\JBoss-2.4.6\examples\org\jboss\docs\jaas\howto>java DSTest
      javax.naming.NameNotFoundException: DefaultDS not bound
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
      RemoteCall.java:245)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
      220)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:435)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:419)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at DSTest.main(DSTest.java:22)


      Thanks in Advance
      Raju M