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 F17A0109C9 for ; Thu, 6 Feb 2014 12:47:08 +0000 (UTC) Received: (qmail 17005 invoked by uid 500); 6 Feb 2014 12:47:04 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 16650 invoked by uid 500); 6 Feb 2014 12:47:03 -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 16637 invoked by uid 99); 6 Feb 2014 12:47:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Feb 2014 12:47:02 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of knst.kolinko@gmail.com designates 209.85.216.181 as permitted sender) Received: from [209.85.216.181] (HELO mail-qc0-f181.google.com) (209.85.216.181) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Feb 2014 12:46:56 +0000 Received: by mail-qc0-f181.google.com with SMTP id e9so2989795qcy.12 for ; Thu, 06 Feb 2014 04:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=OY6wmnqFT+KM7pQLKXJRZi++IteeusBauptxHqKWUnY=; b=LWkx01iI3zvG8FiV5AmmzNiFpxjW8KRLx8XqOOkVxnxnwc6LbnuVli0CDA5JcbvNke uESVu/38nC3E87U2CinusAlK/4b1wYsckGGRRdyd0bn4gXN+e2uaRq5M8MPIL6RtvY2P ObJqr98pWucQf6lWQ8Tc9WrBZL+V3/1rrtsQuX3qsthzALTJouEN/l5EdOW9Ml+x/UWN Uc0wERxtf2NZIM/bKfO6AZbg+DCeR7jLX8SEopQIvp8nknglDEJdP7mZn6posgznSjq+ 2DWoHt5YxPELcdWQ/7VFd2AbKmU50ADfrbUMLrPoCENRZVmgfvlDBN0gTscuVq/Z7G19 5bIg== MIME-Version: 1.0 X-Received: by 10.140.92.54 with SMTP id a51mr6882223qge.111.1391690795313; Thu, 06 Feb 2014 04:46:35 -0800 (PST) Received: by 10.140.94.105 with HTTP; Thu, 6 Feb 2014 04:46:35 -0800 (PST) In-Reply-To: References: Date: Thu, 6 Feb 2014 16:46:35 +0400 Message-ID: Subject: Re: UserDatabase resource into META-INF/context.xml From: Konstantin Kolinko To: Tomcat Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 2014-02-06 Jose Mar=EDa Zaragoza : > Hello: > > I'm using Tomcat 6.0.24 > > I want to set a realm per only one application, so I define in its > META-INF/context.xml > > > > description=3D"User database that can be updated and saved" > factory=3D"org.apache.catalina.users.MemoryUserDatabaseFactory" > name=3DMyUserDatabase" > pathname=3D"conf/my-users.xml" > type=3D"org.apache.catalina.UserDatabase" /> > > resourceName=3D"MyUserDatabase"/> > > > my-users.xml is stored in $CATALINA_BASE/conf/ > > > But it doesn't work; a javax.naming.NameNotFoundException exception is > thrown when Tomcat restarts > > > If I put under GlobalNamingResources in server.xml , works > fine, But I would prefer to held all configuration in context.xml > > is it possible ? or do I need to use GlobalNamingResources ? With the current code: no. It is hardcoded to do JNDI lookup in the global context. It might be possible to port "localDataSource" option from DataSourceRealm class. (MMV. It depends on what ClassLoader is active when MyUserDatabase.startInternal() is invoked). > is the pathname right ? In general I'd prefer to write "${catalina.base}/conf/my-users.xml", but that is just my preference. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org