pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JNDI look up problem in sun java app server 8.1
2+ messages / 2 participants
[nested] [flat]

* JNDI look up problem in sun java app server 8.1
@ 2007-09-02 19:32  Roman Isitua <romanisitua@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Roman Isitua @ 2007-09-02 19:32 UTC (permalink / raw)
  To: pgsql-jdbc

Hello everyone,

I am new to JNDI and application servers. I have a
sample web application that accesses
data stored in postgresql that I want to deploy on the
sun java application server 8.1.
I believe I have followed the guidelines in sun java
i.e register jdbc driver, create connection pool,
jdbc resource. I have done this and i verified this by
clicking the ping button and a success message
was displayed. I am not sure but i think the problem
is with my code:

InitialContext ic = new InitialContext();

 DataSource source =
(DataSource)ic.lookup("java:comp/env/jdbc/books");
   
         connection = source.getConnection();


  each time i run the application i get the following
exception

javax.naming.NameNotFoundException: No object bound to
name java:comp/env/jdbc/books

        at
com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:751)
        at
com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
        at
com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
        at
javax.naming.InitialContext.lookup(InitialContext.java:392)
        at
com.deitel.advjhtp1.store.TitlesBean.<init>(TitlesBean.java:38)

The name of the data source i configured in sun java
is jdbc/books. I made sure that the database exists
and can be accessed from a java application. I
confirmed this by using the Drivermanager class. 

My question is where have I gone wrong? is it my code
or am I missing something out in the 
configuration settings i made in sun java? some of the
settings I made in sun java are as follows:

datasource classname:
org.postgresql.ds.PGSimpleDataSource

resource type: javax.sql.connectionPoolDataSource

Additional properties:

datasourceName: jdbc/books
user: postgres
port:5432
databaseName: books
serverName: localhost

   
Thanks in advance.
Roman











       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: JNDI look up problem in sun java app server 8.1
@ 2007-09-03 07:13  Mayuresh Nirhali <Mayuresh.Nirhali@Sun.COM>
  parent: Roman Isitua <romanisitua@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Mayuresh Nirhali @ 2007-09-03 07:13 UTC (permalink / raw)
  To: Roman Isitua <romanisitua@yahoo.com>; pgsql-jdbc

Roman,

Did you try following,

ic.lookup("jdbc/books");


HTH
Mayuresh

Roman Isitua wrote:
> Hello everyone,
>
> I am new to JNDI and application servers. I have a
> sample web application that accesses
> data stored in postgresql that I want to deploy on the
> sun java application server 8.1.
> I believe I have followed the guidelines in sun java
> i.e register jdbc driver, create connection pool,
> jdbc resource. I have done this and i verified this by
> clicking the ping button and a success message
> was displayed. I am not sure but i think the problem
> is with my code:
>
> InitialContext ic = new InitialContext();
>
>  DataSource source =
> (DataSource)ic.lookup("java:comp/env/jdbc/books");
>    
>          connection = source.getConnection();
>
>
>   each time i run the application i get the following
> exception
>
> javax.naming.NameNotFoundException: No object bound to
> name java:comp/env/jdbc/books
>
>         at
> com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:751)
>         at
> com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
>         at
> com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
>         at
> javax.naming.InitialContext.lookup(InitialContext.java:392)
>         at
> com.deitel.advjhtp1.store.TitlesBean.<init>(TitlesBean.java:38)
>
> The name of the data source i configured in sun java
> is jdbc/books. I made sure that the database exists
> and can be accessed from a java application. I
> confirmed this by using the Drivermanager class. 
>
> My question is where have I gone wrong? is it my code
> or am I missing something out in the 
> configuration settings i made in sun java? some of the
> settings I made in sun java are as follows:
>
> datasource classname:
> org.postgresql.ds.PGSimpleDataSource
>
> resource type: javax.sql.connectionPoolDataSource
>
> Additional properties:
>
> datasourceName: jdbc/books
> user: postgres
> port:5432
> databaseName: books
> serverName: localhost
>
>    
> Thanks in advance.
> Roman
>
>
>
>
>
>
>
>
>
>
>
>        
> ____________________________________________________________________________________
> Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
> http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>   




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-09-03 07:13 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-09-02 19:32 JNDI look up problem in sun java app server 8.1 Roman Isitua <romanisitua@yahoo.com>
2007-09-03 07:13 ` Mayuresh Nirhali <Mayuresh.Nirhali@Sun.COM>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox