private void init(final Properties properties) throws Exception { if (openejb != null && openejb.isInitialized()) { return; } openejb = new OpenEJBInstance(); if (openejb.isInitialized()) { return; } bootedOpenEJB = true; SystemInstance.init(properties); OptionsLog.install(); SystemInstance.get().setProperty("openejb.embedded", "true"); openejb.init(properties); }
private void checkOpenEjbHome(File openejbHome) throws Exception { try { String homePath = openejbHome.getAbsolutePath(); if (!openejbHome.exists()) handleError(BAD_HOME + homePath, NOT_THERE, INSTRUCTIONS); if (!openejbHome.isDirectory()) handleError(BAD_HOME + homePath, NOT_DIRECTORY, INSTRUCTIONS); File openejbHomeLibs = new File(openejbHome, "lib"); if (!openejbHomeLibs.exists()) handleError(BAD_HOME + homePath, NO_DIST, INSTRUCTIONS); String[] libs = openejbHomeLibs.list(); boolean found = false; for (int i = 0; i < libs.length && !found; i++) { found = (libs[i].startsWith("openejb-") && libs[i].endsWith(".jar")); } if (!found) handleError(BAD_HOME + homePath, NO_LIBS, INSTRUCTIONS); } catch (Exception e) { e.printStackTrace(); } }
public OpenEJBInstance() throws Exception { final Class<?> openejb = loadOpenEJBClass(); this.init = openejb.getMethod("init", Properties.class); this.isInitialized = openejb.getMethod("isInitialized"); }
private Class<?> loadOpenEJBClass() throws Exception { final ClassPath classPath = SystemInstance.get().getClassPath(); final ClassLoader classLoader = classPath.getClassLoader(); try { return classLoader.loadClass("org.apache.openejb.OpenEJB"); } catch (final Exception e) { try { checkOpenEjbHome(SystemInstance.get().getHome().getDirectory()); final FileUtils home = SystemInstance.get().getHome(); classPath.addJarsToPath(home.getDirectory("lib")); } catch (final Exception e2) { throw new Exception("Could not load OpenEJB libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); } try { return classLoader.loadClass("org.apache.openejb.OpenEJB"); } catch (final Exception e2) { throw new Exception("Could not load OpenEJB class after embedding libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); } } }
protected void init(final Hashtable env) throws NamingException { final ReentrantLock l = lock; l.lock(); try { if (openejb != null && openejb.isInitialized()) { return; } try { final Properties properties = new Properties(); properties.putAll(env); init(properties); } catch (final Exception e) { throw (NamingException) new NamingException("Attempted to load OpenEJB. " + e.getMessage()).initCause(e); } } finally { l.unlock(); } }
private Class<?> loadOpenEJBClass() throws Exception { final ClassPath classPath = SystemInstance.get().getClassPath(); final ClassLoader classLoader = classPath.getClassLoader(); try { return classLoader.loadClass("org.apache.openejb.OpenEJB"); } catch (final Exception e) { try { checkOpenEjbHome(SystemInstance.get().getHome().getDirectory()); final FileUtils home = SystemInstance.get().getHome(); classPath.addJarsToPath(home.getDirectory("lib")); } catch (final Exception e2) { throw new Exception("Could not load OpenEJB libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); } try { return classLoader.loadClass("org.apache.openejb.OpenEJB"); } catch (final Exception e2) { throw new Exception("Could not load OpenEJB class after embedding libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); } } }
protected void init(final Hashtable env) throws NamingException { final ReentrantLock l = lock; l.lock(); try { if (openejb != null && openejb.isInitialized()) { return; } try { final Properties properties = new Properties(); properties.putAll(env); init(properties); } catch (final Exception e) { throw (NamingException) new NamingException("Attempted to load OpenEJB. " + e.getMessage()).initCause(e); } } finally { l.unlock(); } }
private void init(final Properties properties) throws Exception { if (openejb != null && openejb.isInitialized()) { return; } openejb = new OpenEJBInstance(); if (openejb.isInitialized()) { return; } bootedOpenEJB = true; SystemInstance.init(properties); OptionsLog.install(); SystemInstance.get().setProperty("openejb.embedded", "true"); openejb.init(properties); }
public OpenEJBInstance() throws Exception { final Class<?> openejb = loadOpenEJBClass(); this.init = openejb.getMethod("init", Properties.class); this.isInitialized = openejb.getMethod("isInitialized"); }
private Class<?> loadOpenEJBClass() throws Exception { ClassPath classPath = SystemInstance.get().getClassPath(); ClassLoader classLoader = classPath.getClassLoader(); try { return classLoader.loadClass("org.apache.openejb.OpenEJB"); } catch (Exception e) { try { checkOpenEjbHome(SystemInstance.get().getHome().getDirectory()); FileUtils home = SystemInstance.get().getHome(); classPath.addJarsToPath(home.getDirectory("lib")); } catch (Exception e2) { throw new Exception("Could not load OpenEJB libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); } try { return classLoader.loadClass("org.apache.openejb.OpenEJB"); } catch (Exception e2) { throw new Exception("Could not load OpenEJB class after embedding libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); } } }
private void checkOpenEjbHome(final File openejbHome) throws Exception { try { final String homePath = openejbHome.getAbsolutePath(); if (!openejbHome.exists()) { handleError(BAD_HOME + homePath, NOT_THERE, INSTRUCTIONS); } if (!openejbHome.isDirectory()) { handleError(BAD_HOME + homePath, NOT_DIRECTORY, INSTRUCTIONS); } final File openejbHomeLibs = new File(openejbHome, "lib"); if (!openejbHomeLibs.exists()) { handleError(BAD_HOME + homePath, NO_DIST, INSTRUCTIONS); } final String[] libs = openejbHomeLibs.list(); boolean found = false; for (int i = 0; i < libs.length && !found; i++) { found = (libs[i].startsWith("openejb-") && libs[i].endsWith(".jar")); } if (!found) { handleError(BAD_HOME + homePath, NO_LIBS, INSTRUCTIONS); } } catch (final Exception e) { e.printStackTrace(); } }
public void init(Properties properties) throws Exception { if (openejb != null) return; openejb = new OpenEJBInstance(); if (openejb.isInitialized()) return; bootedOpenEJB = true; SystemInstance.init(properties); OptionsLog.install(); SystemInstance.get().setProperty("openejb.embedded", "true"); openejb.init(properties); }
public OpenEJBInstance() throws Exception { Class<?> openejb = loadOpenEJBClass(); this.init = openejb.getMethod("init", Properties.class); this.isInitialized = openejb.getMethod("isInitialized"); }
private void checkOpenEjbHome(final File openejbHome) throws Exception { try { final String homePath = openejbHome.getAbsolutePath(); if (!openejbHome.exists()) { handleError(BAD_HOME + homePath, NOT_THERE, INSTRUCTIONS); } if (!openejbHome.isDirectory()) { handleError(BAD_HOME + homePath, NOT_DIRECTORY, INSTRUCTIONS); } final File openejbHomeLibs = new File(openejbHome, "lib"); if (!openejbHomeLibs.exists()) { handleError(BAD_HOME + homePath, NO_DIST, INSTRUCTIONS); } final String[] libs = openejbHomeLibs.list(); boolean found = false; for (int i = 0; i < libs.length && !found; i++) { found = (libs[i].startsWith("openejb-") && libs[i].endsWith(".jar")); } if (!found) { handleError(BAD_HOME + homePath, NO_LIBS, INSTRUCTIONS); } } catch (final Exception e) { e.printStackTrace(); } }