From user-return-4638-apmail-geronimo-user-archive=geronimo.apache.org@geronimo.apache.org Mon Sep 04 03:28:31 2006 Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 95206 invoked from network); 4 Sep 2006 03:28:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Sep 2006 03:28:31 -0000 Received: (qmail 10074 invoked by uid 500); 4 Sep 2006 03:28:29 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 10048 invoked by uid 500); 4 Sep 2006 03:28:29 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 10037 invoked by uid 99); 4 Sep 2006 03:28:29 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Sep 2006 20:28:29 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=DNS_FROM_RFC_ABUSE,FROM_HAS_MIXED_NUMS,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of c1vamsi1c@gmail.com designates 64.233.182.186 as permitted sender) Received: from [64.233.182.186] (HELO nf-out-0910.google.com) (64.233.182.186) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Sep 2006 20:28:28 -0700 Received: by nf-out-0910.google.com with SMTP id m19so302147nfc for ; Sun, 03 Sep 2006 20:28:07 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=PCF4MKO877lzKM0+SWkr1Mddl5XZqRwkK+IuYH9PynGy75ebGWV6Z1eySh3tR403AIHfHRS3jyg84HF9Ua/eBOYMKM1d70NYwZpsr+TihLt/3a1YnNQ9M+0VJrJSX2kMpDIJUUP0at3V7XwxgOl8b4s6cYh2ppi2bRoVW4aAexg= Received: by 10.48.220.15 with SMTP id s15mr6166407nfg; Sun, 03 Sep 2006 20:28:07 -0700 (PDT) Received: by 10.49.51.19 with HTTP; Sun, 3 Sep 2006 20:28:07 -0700 (PDT) Message-ID: <22d56c4d0609032028i6b9a46b1n794dffeee17d92d1@mail.gmail.com> Date: Mon, 4 Sep 2006 08:58:07 +0530 From: "Vamsavardhana Reddy" To: user@geronimo.apache.org Subject: Re: Database pool problem In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_29984_13806430.1157340487128" References: <000001c6cf9b$4597bad0$0a00000a@cartman> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_29984_13806430.1157340487128 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Bob, You will need to add a cast in the second line of code above. It should look like the following: javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("java:comp/env/jdbc/cl"); Vamsi On 9/4/06, Bob Dushok wrote: > > Rik, > Thanks for the reply. > > The errors change when I make the code changes. I'm now > encountering the following: > > org.apache.jasper.JasperException: Unable to compile class for JSP > > An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp > Generated servlet error: > Type mismatch: cannot convert from Object to DataSource > > An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp > Generated servlet error: > javax.sql.Connection cannot be resolved to a type > > Bob > > On Sep 3, 2006, at 4:55 PM, Rik wrote: > > > Hi, > > > > > > Do you still have those errors if you replace your code with the > > following? > > > > javax.naming.InitialContext ctx = new javax.naming.InitialContext(); > > javax.sql.DataSource ds = ctx.lookup("java:comp/env/jdbc/cl"); > > javax.sql.Connection con = ds.getConnection(); > > > > > > Rik > > > > Within my code I attempt to access the pool as follows: > > > > InitialContext ctx = new InitialContext(); > > DataSource ds = ctx.lookup("java:comp/env/jdbc/cl"); > > Connection con = ds.getConnection(); > > > > When the page executes I receive the following errors: > > org.apache.jasper.JasperException: Unable to compile class for JSP > > > > An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp > > Generated servlet error: > > InitialContext cannot be resolved to a type > > > > An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp > > Generated servlet error: > > InitialContext cannot be resolved to a type > > > > An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp > > Generated servlet error: > > DataSource cannot be resolved to a type > > > > Could someone tell me what I've done incorrectly? The process seems > > straightforward, but I've done something incorrectly. > > > > Thanks, > > Bob > > > > > > ------=_Part_29984_13806430.1157340487128 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Bob,

You will need to add a cast in the second line of code above.  It should look like the following:

javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("java:comp/env/jdbc/cl");

Vamsi

On 9/4/06, Bob Dushok <bdushok@mac.com> wrote:
Rik,
         Thanks for the reply.

         The errors change when I make the code changes.  I'm now
encountering the following:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
Generated servlet error:
Type mismatch: cannot convert from Object to DataSource

An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
Generated servlet error:
javax.sql.Connection cannot be resolved to a type

          Bob

On Sep 3, 2006, at 4:55 PM, Rik wrote:

> Hi,
>
>
> Do you still have those errors if you replace your code with the
> following?
>
> javax.naming.InitialContext ctx = new javax.naming.InitialContext();
> javax.sql.DataSource ds = ctx.lookup("java:comp/env/jdbc/cl");
> javax.sql.Connection con = ds.getConnection();
>
>
> Rik
>
> Within my code I attempt to access the pool as follows:
>
>          InitialContext ctx = new InitialContext();
>          DataSource ds = ctx.lookup("java:comp/env/jdbc/cl");
>          Connection con = ds.getConnection();
>
> When the page executes I receive the following errors:
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
> Generated servlet error:
> InitialContext cannot be resolved to a type
>
> An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
> Generated servlet error:
> InitialContext cannot be resolved to a type
>
> An error occurred at line: 12 in the jsp file: /demo/pooltest.jsp
> Generated servlet error:
> DataSource cannot be resolved to a type
>
> Could someone tell me what I've done incorrectly?  The process seems
> straightforward, but I've done something incorrectly.
>
> Thanks,
> Bob
>
>


------=_Part_29984_13806430.1157340487128--