From the exception message probably the jdbc name you are looking for is not bound in the JNDI namespace. An easy way to solve the problem is to use the jmx-console.
 
 
Then choose service=JNDIView
 
go at the bottom of the screen and press the 'invoke' button.
 
Look under java:Namespace. The jndi name for your datasource should be there. If you can't see it, there is a possibility that the Datasouce hasn't been set up correctly.
 
Hope it will help,
 
Marco
----- Original Message -----
Sent: Sunday, June 08, 2003 2:24 PM
Subject: Re: [JBoss-user] Problems with JBoss on JNDI Data Source Connection

Try the Lookup this way:
 
 
   DataSource ds = (DataSource) jndiContext.lookup("java:/dbnrhdes");
 
I had been using DataSources in JBoss and everything is ok....
 
I hope help you
 
Edgar Silva

----- Original Message -----
Sent: Thursday, June 05, 2003 9:53 PM
Subject: [JBoss-user] Problems with JBoss on JNDI Data Source Connection

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