Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 5211 invoked from network); 16 Jun 2010 23:37:47 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Jun 2010 23:37:47 -0000 Received: (qmail 8819 invoked by uid 500); 16 Jun 2010 23:37:44 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 8769 invoked by uid 500); 16 Jun 2010 23:37:43 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 8760 invoked by uid 99); 16 Jun 2010 23:37:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jun 2010 23:37:43 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [76.96.30.24] (HELO qmta02.emeryville.ca.mail.comcast.net) (76.96.30.24) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jun 2010 23:37:36 +0000 Received: from omta11.emeryville.ca.mail.comcast.net ([76.96.30.36]) by qmta02.emeryville.ca.mail.comcast.net with comcast id WkVy1e0050mlR8UA2ndFDW; Wed, 16 Jun 2010 23:37:15 +0000 Received: from [192.168.1.107] ([99.150.113.144]) by omta11.emeryville.ca.mail.comcast.net with comcast id Wnd51e00a36zGSB8Xnd81c; Wed, 16 Jun 2010 23:37:13 +0000 Message-ID: <4C196021.5040905@christopherschultz.net> Date: Wed, 16 Jun 2010 19:37:05 -0400 From: Christopher Schultz User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Resource Annotation has no effect but JNDI Lookup works (JDBC Resource) References: <28900220.post@talk.nabble.com> <364267.19426.qm@web38207.mail.mud.yahoo.com> In-Reply-To: <364267.19426.qm@web38207.mail.mud.yahoo.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Gurkan, On 6/16/2010 10:44 AM, Gurkan Erdogdu wrote: > Please define some servlet and try with it, > > class TestClass extends HttpServlet{ > > private @Resource(name="jdbc/TestDb") DataSource datasource; > > @PostConstruct > public void postConstruct(){ > //Check datasource here > } > } While this example appears to work, I might recommend to the reader that using a JDBC DataSource directly in a servlet should probably be considered poor architecture. I would recommend putting your data-fetching logic in a support class, which will be easier to test and maintain over time. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwZYCEACgkQ9CaO5/Lv0PCi9QCeNZoqsj8I+H+1XI4tOWgzomyE /FgAn1EqT6y+9v7Hbwcdt7n2yRo5mDCD =GpeJ -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org