Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D9D04D57C for ; Sun, 7 Oct 2012 15:34:54 +0000 (UTC) Received: (qmail 12957 invoked by uid 500); 7 Oct 2012 15:34:51 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 12878 invoked by uid 500); 7 Oct 2012 15:34:51 -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 12869 invoked by uid 99); 7 Oct 2012 15:34:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Oct 2012 15:34:51 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [98.139.212.185] (HELO nm26.bullet.mail.bf1.yahoo.com) (98.139.212.185) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Oct 2012 15:34:42 +0000 Received: from [98.139.212.145] by nm26.bullet.mail.bf1.yahoo.com with NNFMP; 07 Oct 2012 15:34:21 -0000 Received: from [98.139.211.193] by tm2.bullet.mail.bf1.yahoo.com with NNFMP; 07 Oct 2012 15:34:21 -0000 Received: from [127.0.0.1] by smtp202.mail.bf1.yahoo.com with NNFMP; 07 Oct 2012 15:34:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1349624061; bh=o4nufrUpsz24SbxAK3p/iF1+vjVom/txTQutDkPtCN8=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=joLW/5tDeDyAuoGkiv5SR32q5nz4J425zfmdtqm/I5kBwvyNaTPyHhWpFa5xkRuqN5zaEjHTEiNvIJ9yuJHdtlUOFxmz/c9XOlQtnXo2Qq5elRwoV2xX7YMxSqyDX9LFuIMU00dVTcNmikGcFWLN2B6/jBE+0mxvz2fMQCDSiDM= X-Yahoo-Newman-Id: 250598.88915.bm@smtp202.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: aj5jjJkVM1nrdNjFp9OX64g8pUju5wYCidYVRP1ld4Tmric QBHrUyvxMGDwDxEIV.YCWM3awoDqo60BrDBrv_ahth2YkcL3oGZ8iAaqLQOP 850fsLhmBAbFsJ4UWgsxy4BduAc6tSlpLto5h3N1qEkEgyQExrNz7C8pzaBM QQpdeKYqNxtK2hTryuBIdfPoMCb8yB0xfmyLM56ldybErJ_3U7AZrxdVpqA7 _hkDvJI4IUhcYM5VHkc9IjPzWGTe_ZVTFqoH9keVwlyfiSUgQDwlVGGBeioo _6sZUKL4sywRg_DzEIcPRycHd_hfNfsbztS8QN92Hr7v1Uq9xkf6i4c3ZKF2 iNYWqeSGW3FdNoODp8ET0uDCfaGaxjfKO575wCDC3ImFSI4_Im29uLocSs5B 7TYRIv_L5GtlAi1b8XuXayPwDfP9jNRm3rNuNPeef3Rg9z3uyoyVQ053ffdU 4M5t36j5E2F3nL_2x8qqpJqDHJHA.83vqLnB62bIV4N9ZU7WrxP8GE4rMjHu qLGeEIiOIGCxWVmqIMpW7IXg3rkTzyNsCSJUo3YAr_ADahdS1OaAo X-Yahoo-SMTP: PKuT8k2swBCeFOHzkGy5rTOUTa2hBxlR Received: from [127.0.0.1] (its_toasted@71.133.241.218 with plain) by smtp202.mail.bf1.yahoo.com with SMTP; 07 Oct 2012 08:34:21 -0700 PDT Message-ID: <5071A0C8.1070509@yahoo.com> Date: Sun, 07 Oct 2012 08:33:28 -0700 From: Mark Eggers User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: JDBCRealm conection timeout failure on getPassword References: <-1074036205031100349@unknownmsgid> In-Reply-To: <-1074036205031100349@unknownmsgid> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/7/2012 8:22 AM, Pid * wrote: > On 7 Oct 2012, at 15:26, Aladin Dajani wrote: > >> OK So I tried to use DataSourceRealm. Seems simple enough. but I get the >> following exception: >> >> Oct 7, 2012 9:54:51 AM org.apache.catalina.realm.DataSourceRealm open >> SEVERE: Exception performing authentication >> javax.naming.NameNotFoundException: Name jdbc is not bound in this Context >> >> Here is my configuration. context.xml is unchanged from previous setup >> (works well for pooled database access within the app) >> >> {catalina-base}\conf\context.xml: >> > name="jdbc/MyAppDB" >> auth="Container" >> driverClassName="com.mysql.jdbc.Driver" >> logAbandoned="true" >> maxActive="100" >> maxIdle="30" >> maxWait="10000" >> password="password" >> username="user" >> removeAbandoned="true" >> removeAbandonedTimeout="60" >> type="javax.sql.DataSource" >> url="jdbc:mysql://localhost:3306/databasename" >> /> >> >> Server.xml replaces the JDBCRealm with the DataSourceRealm as below >> >> {catalina-base}\conf\server.xml: >> >> > dataSourceName="jdbc/MyAppDB" >> userTable="users" >> userNameCol="username" >> userCredCol="password" >> userRoleTable="roles" >> roleNameCol="rolename" >> digest="MD5" >> /> >> >> >> Have I missed a configuration somewhere ? > > Yes, define the Resource in GlobalResources in server.xml. > > > p Here's the Wiki document on the various combinations: http://wiki.apache.org/tomcat/TomcatDataSourceRealms /mde/ >> >> Thanks. >> On Sun, Oct 7, 2012 at 9:36 AM, Felix Schumacher < >> felix.schumacher@internetallee.de> wrote: >> >>> >>> >>> Aladin Dajani schrieb: >>> >>>> Hello List, >>>> >>>> My application is configured for JDBCRealm authentication uses a MySQL >>>> database. >>>> For my own use inside the application, I have setup a connection pool >>>> to >>>> access the database, However, the configuration of JDBCRealm in >>>> server.xml >>>> uses astand-alone connection. Since MySQL times-out connections after >>>> 8 >>>> hours, I get the following error in tomcat logs as I try to log-in >>>> after >>>> the connection times out: >>>> >>>> Oct 7, 2012 8:36:51 AM org.apache.catalina.realm.JDBCRealm getPassword >>>> SEVERE: Exception performing authentication >>>> com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: >>>> No >>>> operations allowed after connection closed.Connection was implicitly >>>> closed >>>> by the driver. >>>> >>>> Users do not notice this error (I presume tomcat's JDBCRealm will >>>> create a >>>> new connection), but it US disconcerting to have all these exceptions >>>> in >>>> tomcat logs, especially that when the server goes into production mode, >>>> I >>>> fear this will have adverse effects. >>>> >>>> Is it possible to have JDBDRealm use the same connection pool which my >>>> application uses (which is setup in tomcat's context.xml so it should >>>> be accessible to all applications in tomcat). >>> >>> Have a look at DatasourceRealm. >>> >>> Regards >>> Felix >>>> >>>> Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org