This content has been marked as final.
Show 2 replies
-
1. Re: How do tell if code is executing inside the app server?
raydecampo Jun 6, 2012 1:33 PM (in response to dabramov)Isn't this what the property system InitialContext is set up to use is for? What I'm getting at is, is there some reason not to use the built in mechanisms in InitialContext to get the right InitialContext for well, the right context?
-
2. Re: How do tell if code is executing inside the app server?
dahm Jun 7, 2012 4:25 AM (in response to dabramov)Hi,
we have similar code and the simplest way is to refactor your class so that the InitialContext is injected upon construction. I.e., pass it in the constructor.
The client determines then how to create the context.
a) Either you call your utility class from a Session Bean: use new InitialContext()
b) From some remote client: Have a jndi.properties file or use new InitialContext(props)
Cheers
Markus