Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 58989 invoked from network); 9 Feb 2011 10:04:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Feb 2011 10:04:13 -0000 Received: (qmail 90417 invoked by uid 500); 9 Feb 2011 10:04:09 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 90035 invoked by uid 500); 9 Feb 2011 10:04:05 -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 89987 invoked by uid 99); 9 Feb 2011 10:04:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Feb 2011 10:04:04 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of cjderham@gmail.com designates 209.85.212.45 as permitted sender) Received: from [209.85.212.45] (HELO mail-vw0-f45.google.com) (209.85.212.45) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Feb 2011 10:03:57 +0000 Received: by vws12 with SMTP id 12so3509963vws.18 for ; Wed, 09 Feb 2011 02:03:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to :content-type; bh=qKIsWS5Mv74xl85GT9nZQHnq/cgt7V5MCqAVXgRtpR8=; b=xLBWzjHVhwAjnPDw8XKKmCkW6CCK4lS1TvRXL1bS9tktqD6Ew6JDea6k8P+0J7X3qx GPV4cGkLoHdOgtvisLyDZWJbnOVuXUMp7FVlZ2k6mmRcTiw21iezT+8hSCF9GABEN/Tk 1hoT6ux7ycqe0G16linLKLMXcOWVSbQbB+h2Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=MpOtCup9TYx+XFyHB9+dWXtxAHav9O/5aXcLgXD0s1A+ombxozPjW46g7pbpF8rbzk bZxfSFOOqPISEMnx99i5VA0GY+LjHmPINIHU7n5pegh3n34cAxPB39MA7HulzeiLxM+Z //5HrdBorx2GMjIhdkzVSYer7GYa6pFoWJF38= Received: by 10.220.178.200 with SMTP id bn8mr2407882vcb.169.1297245815971; Wed, 09 Feb 2011 02:03:35 -0800 (PST) MIME-Version: 1.0 Sender: cjderham@gmail.com Reply-To: chris@derham.me.uk Received: by 10.220.77.143 with HTTP; Wed, 9 Feb 2011 02:03:15 -0800 (PST) In-Reply-To: <4D526331.7010702@axivion.com> References: <4D525B8B.5080900@axivion.com> <4D526331.7010702@axivion.com> From: chris derham Date: Wed, 9 Feb 2011 08:03:15 -0200 X-Google-Sender-Auth: fqf1c4ldlp08E_xUHbQzcd99uHs Message-ID: Subject: Re: Context.xml for multiple datasources To: Tomcat Users List Content-Type: multipart/alternative; boundary=90e6ba53a5460c20e4049bd6941c X-Virus-Checked: Checked by ClamAV on apache.org --90e6ba53a5460c20e4049bd6941c Content-Type: text/plain; charset=ISO-8859-1 > And the question is: > How to build the context to move the existing Spring configuration to the > Tomcat context to get all datasources with JNDI. > The problem is, that it must be possible to set a variable amount of > databases. I can't set the number of databases to a fixed amount. > Building the Resources for the beans named parentDataSource, firstDataSource > and secondDataSource is like configuring a single database. > But How can I create a JNDI lookable resource like the bean named > dataSource containing a map of all available database resources? > >From your original post, in which you stated "This is my working Spring datasource.xml:" In spring you are building a map of data sources that are also defined in spring. Why not build a map of data sources that are defined in context.xml and spring looks them up? You say that you need variable amounts of databases, but the code you posted and said "this worked" doesn't support this - to add a new datasource you would have to update spring config. If you really need variable databases, then some custom code to load a custom configuration of such data sources might be the way to go. Then just use a resource element in context to get tomcat to load that for the instance. Chris --90e6ba53a5460c20e4049bd6941c--