/** * Lazy load the WebLogic MBeanServer instance. * * @return */ private static MBeanServer getWLSMBeanServer() { if (wlsMBeanServer == null) { Context weblogicContext = null; try { weblogicContext = new InitialContext(); try { // The lookup string used depends on the context from which this class is being // accessed, i.e. servlet, EJB, etc. Try java:comp/env lookup wlsMBeanServer = (MBeanServer) weblogicContext.lookup(WLS_ENV_CONTEXT_LOOKUP); } catch (NamingException e) { // Lookup failed - try java:comp try { wlsMBeanServer = (MBeanServer) weblogicContext.lookup(WLS_CONTEXT_LOOKUP); } catch (NamingException ne) { throw SDOException.errorPerformingWLSLookup(WLS_MBEAN_SERVER, ne); } } } catch (NamingException nex) { throw SDOException.errorCreatingWLSInitialContext(nex); } } return wlsMBeanServer; }
/** * Lazy load the WebLogic MBeanServer instance. * * @return */ private static MBeanServer getWLSMBeanServer() { if (wlsMBeanServer == null) { Context weblogicContext = null; try { weblogicContext = new InitialContext(); try { // The lookup string used depends on the context from which this class is being // accessed, i.e. servlet, EJB, etc. Try java:comp/env lookup wlsMBeanServer = (MBeanServer) weblogicContext.lookup(WLS_ENV_CONTEXT_LOOKUP); } catch (NamingException e) { // Lookup failed - try java:comp try { wlsMBeanServer = (MBeanServer) weblogicContext.lookup(WLS_CONTEXT_LOOKUP); } catch (NamingException ne) { throw SDOException.errorPerformingWLSLookup(WLS_MBEAN_SERVER, ne); } } } catch (NamingException nex) { throw SDOException.errorCreatingWLSInitialContext(nex); } } return wlsMBeanServer; }