Hi...
 
I have taken some exceptions with my JBoss...jboss-3.0.6_tomcat-4.1.18
...the client classpath is ok...
my jdk version is jdk1.3.1 and it�s ok...
 
I wrote a simple test code...
 
package com.ccibm.wiredsys.xclient;
 
import java.beans.Beans;
import java.io.IOException;
import java.io.Serializable;
import java.sql.Connection;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
 
public class SQLJndiConnectionTest extends Beans implements Serializable {
 
 public SQLJndiConnectionTest() {
 }
 
 public static void main(String[] args)
  throws IOException, NamingException {
 
  try {
   
   Properties props = new Properties();
   
   props.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
   props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
   props.put("java.naming.provider.url","jnp://localhost:1099");
     
   InitialContext jndiContext = new InitialContext(props);
   DataSource ds = (DataSource) jndiContext.lookup("java:/jdbc/dbnrhdes");
   Connection conn = ds.getConnection();
 
   if (conn != null || conn.isClosed() == false) {
    System.out.println(
     "Connection --> " + (int) conn.toString().hashCode());
    conn.close();
    ds = null;
    jndiContext = null;
   } else {
    System.out.println("No active connections !!!");
   }
  } catch (Exception e) {
   System.out.println("No active connections !!!");
   e.printStackTrace();
   throw new NamingException(e.getMessage());
  }
 }
}
 
and the exit message is the same all time...
 
No active connections !!!
javax.naming.NameNotFoundException: jdbc not bound
 at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.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:484)
 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:463)
 at javax.naming.InitialContext.lookup(InitialContext.java:350)
 at com.ccibm.wiredsys.xclient.SQLJndiConnectionTest.main(SQLJndiConnectionTest.java:29)
javax.naming.NamingException: jdbc not bound
 at com.ccibm.wiredsys.xclient.SQLJndiConnectionTest.main(SQLJndiConnectionTest.java:44)
Exception in thread "main"
 
someone can help me please !!!

 

Reply via email to