1 Reply Latest reply on Nov 12, 2001 12:45 PM by schaefera

    SQLServer  datasource created but can not bind to it

    eman69

      I guess I start with the problem:

      I get the following error when I run my Test.class:

      F:\dev\test>javac -classpath %CLASSPATH%;I:\jars\jnpserver.jar;. Test.java

      F:\dev\test>java -classpath %CLASSPATH%;I:\jars\jnpserver.jar;. Test
      Exception in thread "main" javax.naming.NameNotFoundException: SQLServer not bound
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknow
      n Source)
      at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at Test.main(Test.java:36)

      F:\dev\test>


      Here is my Test.java code:

      import javax.sql.*;
      import javax.naming.*;
      import com.microsoft.jdbc.sqlserver.*;
      import com.microsoft.jdbc.sqlserver.SQLServerDriver;

      class Test {

      public static void main(String[] args)
      throws NamingException, SQLException
      {

      Hashtable ht = new Hashtable();

      ht.put("java.naming.factory.initial","org.jnp.interfaces.NamingContext
      ht.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interf
      ht.put("java.naming.provider.url","localhost:1099");

      Context ctx = new InitialContext(ht);

      DataSource ds = (DataSource)ctx.lookup("SQLServer");

      //Connection con = ds.getConnection("sa", "sa");
      //con.close();
      }
      }

      Things I know:

      When I start up tomcat/jboss all goes well:

      <snip_it>
      [JaasSecurityManagerService] Initialized
      [JdbcProvider] Initializing
      [JdbcProvider] Loaded JDBC-driver:org.hsqldb.jdbcDriver
      [JdbcProvider] Loaded JDBC-driver:com.microsoft.jdbc.sqlserver.SQLServerDriver
      [JdbcProvider] Initialized
      [HypersonicDatabase] Initializing
      </snip_it>

      then ...

      </snip_it>
      [NamingService] InitialContext Environment:
      [NamingService] key=java.naming.factory.initial, value=org.jnp.interfaces.Naming
      ContextFactory
      [NamingService] key=java.naming.factory.url.pkgs, value=org.jboss.naming:org.jnp
      .interfaces:org.jboss.naming:org.jnp.interfaces
      [NamingService] Naming started on port 1099
      [NamingService] Started
      [JNDIView] Starting
      [JNDIView] Started
      </snip_it>

      then later ....

      <snit_it>
      [XADataSourceLoader] Starting
      [DefaultDS] XA Connection pool DefaultDS bound to java:/DefaultDS
      [XADataSourceLoader] Started
      [XADataSourceLoader] Starting
      [SQLServer] XA Connection pool SQLServer bound to java:/SQLServer
      [XADataSourceLoader] Started
      [ServerDataCollector] Starting
      </snit_it>

      also on the jboss admin page I see:

      service=XADataSource,name=SQLServer

      and in mbean veiw:

      MBean Name: DefaultDomain:service=XADataSource,name=SQLServer
      MBean Java Class: org.jboss.jdbc.XADataSourceLoader

      So I don't know I can't see this datasource.

      also everything written and compiled in jdk 1.3.1

      Please advise! Thanks!