Thanks Chris, After messing around with JNDI yesterday I came to the same conclusion that Tomcat is doing some isolation and I can understand why. I will look into the JMX approach you suggest as I am running out of options. If That doesn't provide a solution I think I will have to deploy our connection pool logic to the shared 'tomcat/lib' directory where static collections will be available to all contexts. Do you see any issues with deploying code within the lib directory?
Many thanks for your help Rob > -----Original Message----- > From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Sent: 17 November 2010 16:44 > To: Tomcat Users List > Subject: Re: Dynamic GlobalNamingResources / Shared JDBC connection pools > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Rob, > > On 11/17/2010 7:07 AM, Rob Gregory wrote: > > Is it possible to just store my existing collection of datasources in > > some global context? > > > > I.e. > > initCtx = new InitialContext(); > > Context envCtx = (Context)initCtx.lookup("java:/comp/env"); > > envCtx.bind("datasource_live", objLiveDatasource); > > envCtx.bind("datasource_test", objTestDatasource); > > > > or something along those lines? > > The above isn't going to work because Tomcat provides webapp isolation > in the JNDI space. > > You should look into the documentation for Tomcat's JMX beans: I'm sure > there is a way to use those to create on-the-fly DataSources (really > DataSourceFactories I think) using the mbeans that Tomcat exposes. > Running under a SecurityManager may complicate that effort. > > - -chris > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkzkBlwACgkQ9CaO5/Lv0PAh5wCeKQssMRezSzwagZ9AmCZuZf/5 > 5gwAoMPy5pYlKYgyYM6UNh/nnH3DAZiI > =jH6U > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org