2 Replies Latest reply on Jun 7, 2012 4:25 AM by Markus Dahm

    How do tell if code is executing inside the app server?

    Daniel Abramovich Newbie



      We have some utilty code which returns JNDI Contexts to the applications which need one, say to lookup the JMS ConnectionFactory. If the code is executing inside the app server all I would need to do is create a new InitialContext(). If the utility is executing out of process it needs to set the factory, provider URL, etc.


      I've tweaked the JNDI named of the ConnectionFactory/RemoteConnectionFactory so they can be looked using the same names whether the Context is local or remote. However, I'm not sure how to have the utlity class determine the appropriate way to create the Context - and therefore hide this from the application code.


      Is there something I can check to figure this out? The less hackish the better, but at least is will be contained inside the utility class.