throw new DeploymentException("Failed to copy the archive assets into the deployment directory", e); } catch (ReflectiveOperationException e) { throw new DefinitionException(e.getCause()); // validation exceptions
public static void undeploy(final DeployableContainer<?> container, final Collection<Archive<?>> containerArchives) { if (containerArchives != null) { for (final Archive<?> a : containerArchives) { try { container.undeploy(a); } catch (final DeploymentException e) { Logger.getLogger(container.getClass().getName()).log(Level.SEVERE, e.getMessage(), e); } } } }
private <T> T deployment(Callable<T> callable) throws DeploymentException { ClassLoader current = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(classloader); return callable.call(); } catch (DeploymentException e) { throw e; } catch (Exception e) { throw new DeploymentException("Could not proxy call", e); } finally { Thread.currentThread().setContextClassLoader(current); } }
@Override public void start() throws LifecycleException { try { initialContext = new InitialContext(properties); } catch (final NamingException e) { throw new LifecycleException("can't start the OpenEJB container", e); } assembler = SystemInstance.get().getComponent(Assembler.class); configurationFactory = (ConfigurationFactory) SystemInstance.get().getComponent(OpenEjbConfigurationFactory.class); if ("true".equalsIgnoreCase(PROPERTIES.getProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE)) && SystemInstance.get().getComponent(WebAppBuilder.class) == null) { SystemInstance.get().setComponent(WebAppBuilder.class, new LightweightWebAppBuilder()); } contextProducer.set(initialContext); containerArchives = ArquillianUtil.toDeploy(properties); for (final Archive<?> archive : containerArchives) { try { quickDeploy(archive, testClass.get()); } catch (final DeploymentException e) { Logger.getLogger(OpenEJBDeployableContainer.class.getName()).log(Level.SEVERE, e.getMessage(), e); } } }
public void observes(@Observes final DeploymentException t) throws Exception { EXCEPTIONS.put(t.getClass(), t); Throwable current = t.getCause(); while (current != null) { if (Exception.class.isInstance(current)) { PARENT_EXCEPTIONS.put(current.getClass(), Exception.class.cast(current)); } if (current.getCause() != current) { current = current.getCause(); } } throw t; // don't forget it even if it is an observer and not an interceptor }
/** * {@inheritDoc} * @see DeployableContainer#undeploy(Descriptor) */ @Override public void undeploy(Descriptor descriptor) throws DeploymentException { if (descriptor == null) throw new DeploymentException("Could not undeploy a null application"); try { embedded.undeploy(descriptor); } catch (Throwable t) { throw new DeploymentException("Could not undeploy the application: " + t.getMessage(), t); } }
@Override public void start() throws LifecycleException { try { initialContext = new InitialContext(properties); } catch (final NamingException e) { throw new LifecycleException("can't start the OpenEJB container", e); } assembler = SystemInstance.get().getComponent(Assembler.class); configurationFactory = (ConfigurationFactory) SystemInstance.get().getComponent(OpenEjbConfigurationFactory.class); if ("true".equalsIgnoreCase(PROPERTIES.getProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE)) && SystemInstance.get().getComponent(WebAppBuilder.class) == null) { SystemInstance.get().setComponent(WebAppBuilder.class, new LightweightWebAppBuilder()); } contextProducer.set(initialContext); containerArchives = ArquillianUtil.toDeploy(properties); final Closeables globalScopeCloseables = new Closeables(); SystemInstance.get().setComponent(Closeables.class, globalScopeCloseables); for (final Archive<?> archive : containerArchives) { try { quickDeploy(archive, testClass.get(), globalScopeCloseables); } catch (final DeploymentException e) { Logger.getLogger(OpenEJBDeployableContainer.class.getName()).log(Level.SEVERE, e.getMessage(), e); } } }
/** * {@inheritDoc} * @see DeployableContainer#deploy(Descriptor) */ @Override public void deploy(Descriptor descriptor) throws DeploymentException { if (descriptor == null) throw new DeploymentException("Could not deploy a null descriptor"); try { embedded.deploy(descriptor); } catch (Throwable t) { throw new DeploymentException("Could not undeploy the application: " + t.getMessage(), t); } }
/** * {@inheritDoc} * @see DeployableContainer#deploy(Descriptor) */ @Override public void deploy(Descriptor descriptor) throws DeploymentException { if (descriptor == null) throw new DeploymentException("Could not deploy a null descriptor"); try { embedded.deploy(descriptor); } catch (Throwable t) { throw new DeploymentException("Could not deploy the application: " + t.getMessage(), t); } }
/** * {@inheritDoc} * @see DeployableContainer#undeploy(Descriptor) */ @Override public void undeploy(Descriptor descriptor) throws DeploymentException { if (descriptor == null) throw new DeploymentException("Could not undeploy a null application"); try { embedded.undeploy(descriptor); } catch (Throwable t) { throw new DeploymentException("Could not undeploy the application: " + t.getMessage(), t); } }
/** * {@inheritDoc} * @see DeployableContainer#undeploy(Descriptor) */ @Override public void undeploy(Descriptor descriptor) throws DeploymentException { if (descriptor == null) throw new DeploymentException("Could not undeploy a null application"); try { embedded.undeploy(descriptor); } catch (Throwable t) { throw new DeploymentException("Could not undeploy the application: " + t.getMessage(), t); } }
private <T> T deployment(Callable<T> callable) throws DeploymentException { ClassLoader current = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(classloader); return callable.call(); } catch (DeploymentException e) { throw e; } catch (Exception e) { throw new DeploymentException("Could not proxy call", e); } finally { Thread.currentThread().setContextClassLoader(current); } }
/** * {@inheritDoc} * @see DeployableContainer#undeploy(Archive) */ @Override public void undeploy(final Archive<?> archive) throws DeploymentException { if (archive == null) throw new DeploymentException("Could not undeploy a null application"); if (!(ResourceAdapterArchive.class.isInstance(archive))) throw new DeploymentException("Could not undeploy a non resource adapter application"); try { embedded.undeploy(ResourceAdapterArchive.class.cast(archive)); } catch (Throwable t) { throw new DeploymentException("Could not undeploy the application: " + t.getMessage(), t); } }
/** * {@inheritDoc} * @see DeployableContainer#undeploy(Archive) */ @Override public void undeploy(final Archive<?> archive) throws DeploymentException { if (archive == null) throw new DeploymentException("Could not undeploy a null application"); if (!(ResourceAdapterArchive.class.isInstance(archive))) throw new DeploymentException("Could not undeploy a non resource adapter application"); try { embedded.undeploy(ResourceAdapterArchive.class.cast(archive)); } catch (Throwable t) { throw new DeploymentException("Could not undeploy the application: " + t.getMessage(), t); } }
/** * {@inheritDoc} * @see DeployableContainer#deploy(Descriptor) */ @Override public void deploy(Descriptor descriptor) throws DeploymentException { if (descriptor == null) throw new DeploymentException("Could not deploy a null descriptor"); try { embedded.deploy(descriptor); } catch (Throwable t) { throw new DeploymentException("Could not deploy the application: " + t.getMessage(), t); } }
private static Path javaPath() throws DeploymentException { String javaHome = System.getProperty("java.home"); if (javaHome == null) { throw new DeploymentException("Unable to locate java binary"); } Path binDir = FileSystems.getDefault().getPath(javaHome, "bin"); Path java = binDir.resolve("java.exe"); if (java.toFile().exists()) { return java; } java = binDir.resolve("java"); if (java.toFile().exists()) { return java; } throw new DeploymentException("Unable to locate java binary"); } }
private String deployInternal(String name, InputStream input) throws DeploymentException { try { return deployer.deploy(name, input); } catch (Exception ex) { Throwable rootCause = ex.getCause(); while (null != rootCause && rootCause.getCause() != null) { rootCause = rootCause.getCause(); } throw new DeploymentException("Cannot deploy: " + name, rootCause); } } }
@Override public synchronized void undeploy(Archive<?> archive) throws DeploymentException { try { this.delegateContainer.stop(); } catch (Exception e) { throw new DeploymentException("Unable to stop process", e); } }
/** * {@inheritDoc} * @see DeployableContainer#undeploy(Archive) */ @Override public void undeploy(final Archive<?> archive) throws DeploymentException { if (archive == null) throw new DeploymentException("Could not undeploy a null application"); if (!(ResourceAdapterArchive.class.isInstance(archive))) throw new DeploymentException("Could not undeploy a non resource adapter application"); try { embedded.undeploy(ResourceAdapterArchive.class.cast(archive)); } catch (Throwable t) { throw new DeploymentException("Could not undeploy the application: " + t.getMessage(), t); } }