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()); } } }
final File lib = new File(home + File.separator + "lib"); final ClassPath systemCP = new SystemClassPath(); systemCP.getClassLoader(); File config = new File(base, "conf/catalina.properties"); if (!config.isFile()) { final File dir = new File(repository.substring(0, repository.length() - "*.jar".length())); if (dir.isDirectory()) { systemCP.addJarsToPath(dir); systemCP.addJarToPath(file.toURI().toURL()); systemCP.addJarToPath(dir.toURI().toURL()); systemCP.addJarsToPath(lib); systemCP.addJarToPath(lib.toURI().toURL()); return systemCP.getClassLoader(); } catch (final Exception e) { System.err.println("Error setting up the classpath: " + e.getClass() + ": " + e.getMessage());
private Class forcefulLoad(ClassPath classPath, ClassLoader classLoader) throws Exception { try { File libsDir; String libsPath = SystemInstance.get().getProperty("openejb.libs"); if (libsPath != null){ libsDir = new File(libsPath); } else { checkOpenEjbHome(SystemInstance.get().getHome().getDirectory()); FileUtils home = SystemInstance.get().getHome(); libsDir = home.getDirectory("lib"); } classPath.addJarsToPath(libsDir); } catch (Exception e2) { throw new Exception("Could not load OpenEJB libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); } try { return classLoader.loadClass(className); } catch (Exception e2) { throw new Exception("Could not load class '"+className+"' after embedding libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); } }
private SystemInstance(Properties properties) throws Exception { this.components = new HashMap<Class, Object>(); this.internalProperties.putAll(System.getProperties()); this.internalProperties.putAll(properties); this.options = new Options(internalProperties, new Options(System.getProperties())); this.home = new FileUtils("openejb.home", "user.dir", this.internalProperties); this.base = new FileUtils("openejb.base", "openejb.home", this.internalProperties); this.classPath = ClassPathFactory.createClassPath(this.internalProperties.getProperty("openejb.loader", "context")); this.classLoader = classPath.getClassLoader(); this.internalProperties.setProperty("openejb.home", home.getDirectory().getCanonicalPath()); this.internalProperties.setProperty("openejb.base", base.getDirectory().getCanonicalPath()); System.setProperty("derby.system.home", base.getDirectory().getCanonicalPath()); // set the magic system property that causes derby to use explicity // file sync instead of relying on vm support for file open rws System.setProperty("derby.storage.fileSyncTransactionLog", "true"); }
libsDir = home.getDirectory("lib"); classPath.addJarsToPath(libsDir); } catch (final Exception e2) { throw new Exception("Could not load OpenEJB libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); final File additionalLib = SystemInstance.get().getBase().getDirectory(ADDITIONAL_LIB_FOLDER); if (additionalLib.exists()) { classPath.addJarsToPath(additionalLib);
/** * Loads the Class object for the className. * * @return * @throws Exception */ public Class load() throws Exception { if (loaderClass == null) { final ClassPath classPath = SystemInstance.get().getClassPath(); final ClassLoader classLoader = classPath.getClassLoader(); try { loaderClass = classLoader.loadClass(className); } catch (final Exception e) { loaderClass = forcefulLoad(classPath, classLoader); } } return loaderClass; }
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()); } } }
libsDir = home.getDirectory("lib"); classPath.addJarsToPath(libsDir); } catch (final Exception e2) { throw new Exception("Could not load OpenEJB libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage()); final File additionalLib = SystemInstance.get().getBase().getDirectory(ADDITIONAL_LIB_FOLDER); if (additionalLib.exists()) { classPath.addJarsToPath(additionalLib);
/** * Loads the Class object for the className. * * @return * @throws Exception */ public Class load() throws Exception { if (loaderClass == null) { final ClassPath classPath = SystemInstance.get().getClassPath(); final ClassLoader classLoader = classPath.getClassLoader(); try { loaderClass = classLoader.loadClass(className); } catch (final Exception e) { loaderClass = forcefulLoad(classPath, classLoader); } } return loaderClass; }
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()); } } }
final SystemInstance system = SystemInstance.get(); File libs = system.getHome().getDirectory("lib"); system.getClassPath().addJarsToPath(libs); initServer(system); } catch (DontStartServerException ignored) {
/** * Loads the Class object for the className. * @return * @throws Exception */ public Class load() throws Exception { if (loaderClass == null) { ClassPath classPath = SystemInstance.get().getClassPath(); ClassLoader classLoader = classPath.getClassLoader(); try { loaderClass = classLoader.loadClass(className); } catch (Exception e) { loaderClass = forcefulLoad(classPath, classLoader); } } return loaderClass; } /**
SystemInstance system = SystemInstance.get(); File libs = system.getHome().getDirectory("lib"); system.getClassPath().addJarsToPath(libs); initServer(); } catch (DontStartServerException ignored) {
this.base = new FileUtils("openejb.base", "openejb.home", this.internalProperties); this.classPath = ClassPathFactory.createClassPath(this.internalProperties.getProperty("openejb.loader", "context")); this.classLoader = classPath.getClassLoader();
this.base = new FileUtils("openejb.base", "openejb.home", this.internalProperties); this.classPath = ClassPathFactory.createClassPath(this.internalProperties.getProperty("openejb.loader", "context")); this.classLoader = classPath.getClassLoader(); final String homeDirCanonicalPath; final String baseDirCanonicalPath;