Put a break point in between and examine Context and its contents. Also
check the spelling/case of datasource "lookup" name. If you are creating the
Datasource yourself, check for any exceptions during its registration. If
the DS is on an application server, talk to your Server admin.

regards
hemant



----- Original Message -----
From: "Laura" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Monday, April 15, 2002 12:25 PM
Subject: PLEASE HELP ME: JNDI ERROR 1


> Other information because I don't know what to do.
>
> The exception is created when I call my function getConnection(). The code
is
> when I execute "con =  ds.getConnection();".
>
> The code is:
>
> static {
>     try  {
>         Context initCtx = new InitialContext();
>         System.out.println("[DEBUG] Dopo l'InitialContext = " +
> initCtx.toString());
>         Context envCtx = (Context) initCtx.lookup("java:comp/env");
>         System.out.println("[DEBUG] Dopo lookup java:comp/env = " +
> envCtx.toString());
>         DataSource ds = (DataSource) envCtx.lookup(dbName);
>         System.out.println("[DEBUG] Datasource = " + ds.toString());
>         con =  ds.getConnection();
>         if (con == null)
>           System.out.println("[ERROR] Connessione nulla");
>       } catch (Exception ex) {
>         System.out.println("[ERROR] Errore = "  + ex.toString() + " \n" +
> ex.getMessage());
>         con = null;
>       }
>   }
>
>
> protected synchronized Connection getConnection() {
>          while (conFree == false) {
>             try {
>                wait();
>             } catch (InterruptedException e) {
>               System.out.println("[ERROR] Eccezione nella getConnection()
= "
> + e.toString());
>             }
>          }
>          conFree = false;
>          System.out.println("[DEBUG] Punto 1");
>          notify();
>          System.out.println("[DEBUG] Punto 2");
>          return con;
>     }
>
>
>
> Please help me.
> Before this code was ok. Has someone some idea?
>
> Help.
>
>
> Laura
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to