Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id F2C7A9F9511 for ; Mon, 3 Sep 2007 04:18:15 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 95378-04 for ; Mon, 3 Sep 2007 04:18:04 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sineb-mail-2.sun.com (sineb-mail-2.sun.com [192.18.19.7]) by postgresql.org (Postfix) with ESMTP id EECD49F9367 for ; Mon, 3 Sep 2007 04:18:10 -0300 (ADT) Received: from fe-apac-05.sun.com (fe-apac-05.sun.com [192.18.19.176] (may be forged)) by sineb-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l837I1kE024573 for ; Mon, 3 Sep 2007 07:18:06 GMT Received: from conversion-daemon.mail-apac.sun.com by mail-apac.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) id <0JNS00M016T00400@mail-apac.sun.com> (original mail from Mayuresh.Nirhali@Sun.COM) for pgsql-jdbc@postgresql.org; Mon, 03 Sep 2007 15:18:01 +0800 (SGT) Received: from [129.158.227.167] by mail-apac.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPSA id <0JNS00D4L6Y04XHG@mail-apac.sun.com>; Mon, 03 Sep 2007 15:18:01 +0800 (SGT) Date: Mon, 03 Sep 2007 12:43:55 +0530 From: Mayuresh Nirhali Subject: Re: JNDI look up problem in sun java app server 8.1 In-reply-to: <256647.81069.qm@web63612.mail.re1.yahoo.com> To: Roman Isitua , pgsql-jdbc@postgresql.org Message-id: <46DBB433.6010608@Sun.COM> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT References: <256647.81069.qm@web63612.mail.re1.yahoo.com> User-Agent: Thunderbird 2.0.0.0 (X11/20070423) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/2 X-Sequence-Number: 17424 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.(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 >