RE: How can code in a Realm gain access to a Globally Named Resource

2014-11-26 Thread vince.webb
Chris, thank you for your reply -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: 26 November 2014 04:17 To: Tomcat Users List Subject: Re: How can code in a Realm gain access to a Globally Named Resource -BEGIN PGP SIGNED MESSAGE-

Re: How can code in a Realm gain access to a Globally Named Resource

2014-11-26 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Vince, On 11/26/14 7:26 AM, vince.w...@thomsonreuters.com wrote: -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: 26 November 2014 04:17 To: Tomcat Users List Subject: Re: How can code in a Realm

Re: How can code in a Realm gain access to a Globally Named Resource

2014-11-26 Thread Mark Thomas
On 26/11/2014 16:23, Christopher Schultz wrote: snip/ I'm not sure, but I would guess you can't define a Realm in server.xml and use a DataSource defined in context.xml. If the Realm is in server.xml, then you should be able to grab the globally-accessible DataSources by using their existing

Re: How can code in a Realm gain access to a Globally Named Resource

2014-11-26 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Mark, On 11/26/14 12:01 PM, Mark Thomas wrote: On 26/11/2014 16:23, Christopher Schultz wrote: snip/ I'm not sure, but I would guess you can't define a Realm in server.xml and use a DataSource defined in context.xml. If the Realm is in

RE: How can code in a Realm gain access to a Globally Named Resource

2014-11-26 Thread vince.webb
Mark Thank you. I looked at DataSourceRealm.open() took the following lines and put them into my custom Realm: /// if (localDataSource) { context = ContextBindings.getClassLoader(); context = (Context) context.lookup(comp/env); } else { context =

Re: How can code in a Realm gain access to a Globally Named Resource

2014-11-26 Thread Konstantin Kolinko
2014-11-27 0:26 GMT+03:00 vince.w...@thomsonreuters.com: Initially I had difficulty with getServer() giving me null. To fix it I stopped calling this method from within the Realm's constructor, instead I get the DataSource the first time it's needed. Learn about org.apache.catalina.Lifecycle

How can code in a Realm gain access to a Globally Named Resource

2014-11-25 Thread vince.webb
Hello Web applications gain access to Globally Named JDBC Resources GlobalNamingResources by adding a ResourceLink to context.xml Then using code like: Context initContext = new InitialContext(); dbLookupStr = java:comp/env/ + dbResourceName; ds = (DataSource)initContext.lookup(dbLookupStr);

Re: How can code in a Realm gain access to a Globally Named Resource

2014-11-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Vince, On 11/25/14 9:00 PM, vince.w...@thomsonreuters.com wrote: Web applications gain access to Globally Named JDBC Resources GlobalNamingResources by adding a ResourceLink to context.xml Then using code like: Context initContext = new