Unix Technical Forum

JNDI look up problem in sun java app server 8.1

This is a discussion on JNDI look up problem in sun java app server 8.1 within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> Hello everyone, I am new to JNDI and application servers. I have a sample web application that accesses data ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces jdbc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-16-2008, 12:53 AM
Roman Isitua
 
Posts: n/a
Default JNDI look up problem in sun java app server 8.1

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.look up(javaURLContext.java:156)
at
com.sun.enterprise.naming.SerialContext.lookup(Ser ialContext.java:307)
at
javax.naming.InitialContext.lookup(InitialContext. java:392)
at
com.deitel.advjhtp1.store.TitlesBean.<init>(Titles Bean.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?...onopolyherenow

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-16-2008, 12:53 AM
Mayuresh Nirhali
 
Posts: n/a
Default Re: JNDI look up problem in sun java app server 8.1

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.look up(javaURLContext.java:156)
> at
> com.sun.enterprise.naming.SerialContext.lookup(Ser ialContext.java:307)
> at
> javax.naming.InitialContext.lookup(InitialContext. java:392)
> at
> com.deitel.advjhtp1.store.TitlesBean.<init>(Titles Bean.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?...onopolyherenow
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:46 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com