Search in sources :

Example 36 with OpenEJBRuntimeException

use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.

the class DeployerEjb method reload.

private void reload(final AppInfo info) {
    if (info.webAppAlone) {
        final WebAppDeployer component = SystemInstance.get().getComponent(WebAppDeployer.class);
        if (null != component) {
            component.reload(info.path);
            return;
        }
    }
    try {
        assembler.destroyApplication(info);
        assembler.createApplication(info);
    } catch (final Exception e) {
        throw new OpenEJBRuntimeException(e);
    }
}
Also used : OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException) UndeployException(org.apache.openejb.UndeployException) OpenEJBException(org.apache.openejb.OpenEJBException) IOException(java.io.IOException) ValidationException(javax.validation.ValidationException) NoSuchApplicationException(org.apache.openejb.NoSuchApplicationException) OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException)

Example 37 with OpenEJBRuntimeException

use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.

the class OpenEJBDeployableContainer method setup.

@Override
public void setup(final OpenEJBConfiguration openEJBConfiguration) {
    properties = new Properties();
    configuration = openEJBConfiguration;
    final ByteArrayInputStream bais = new ByteArrayInputStream(openEJBConfiguration.getProperties().getBytes());
    try {
        properties.load(bais);
    } catch (final IOException e) {
        throw new OpenEJBRuntimeException(e);
    } finally {
        IO.close(bais);
    }
    for (final Map.Entry<Object, Object> defaultKey : PROPERTIES.entrySet()) {
        final String key = defaultKey.getKey().toString();
        if (!properties.containsKey(key)) {
            properties.setProperty(key, defaultKey.getValue().toString());
        }
    }
    ArquillianUtil.preLoadClassesAsynchronously(openEJBConfiguration.getPreloadClasses());
}
Also used : OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException) Properties(java.util.Properties) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap)

Example 38 with OpenEJBRuntimeException

use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.

the class EmbeddedTomEEConfiguration method toProperties.

private static Properties toProperties(final String value) {
    if (value == null || value.isEmpty()) {
        return null;
    }
    final Properties properties = new Properties();
    final ByteArrayInputStream bais = new ByteArrayInputStream(value.getBytes());
    try {
        properties.load(bais);
    } catch (final IOException e) {
        throw new OpenEJBRuntimeException(e);
    } finally {
        try {
            IO.close(bais);
        } catch (final IOException ignored) {
        // no-op
        }
    }
    return properties;
}
Also used : OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException) Properties(java.util.Properties)

Example 39 with OpenEJBRuntimeException

use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.

the class OpenEJBArchiveProcessor method createEjbJar.

private static EjbJar createEjbJar(final String prefix, final Archive<?> webArchive) {
    final EjbJar webEjbJar;
    final Node webEjbJarXml = webArchive.get(prefix.concat(EJB_JAR_XML));
    if (webEjbJarXml != null) {
        try {
            webEjbJar = ReadDescriptors.readEjbJar(webEjbJarXml.getAsset().openStream());
        } catch (final OpenEJBException e) {
            throw new OpenEJBRuntimeException(e);
        }
    } else {
        webEjbJar = new EjbJar();
    }
    return webEjbJar;
}
Also used : OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException) OpenEJBException(org.apache.openejb.OpenEJBException) Node(org.jboss.shrinkwrap.api.Node) EjbJar(org.apache.openejb.jee.EjbJar)

Example 40 with OpenEJBRuntimeException

use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.

the class ConvertDataSourceDefinitions method rawDefinition.

private String rawDefinition(final DataSource d) {
    try {
        final Properties p = new Properties();
        put(p, "transactional", d.getTransactional());
        put(p, "initialPoolSize", d.getInitialPoolSize());
        put(p, "isolationLevel", d.getIsolationLevel());
        put(p, "loginTimeout", d.getLoginTimeout());
        put(p, "maxIdleTime", d.getMaxIdleTime());
        put(p, "maxPoolSize", d.getMaxPoolSize());
        put(p, "maxStatements", d.getMaxStatements());
        put(p, "minPoolSize", d.getMinPoolSize());
        put(p, "portNumber", d.getPortNumber());
        put(p, "databaseName", d.getDatabaseName());
        put(p, "password", d.getPassword());
        put(p, "serverName", d.getServerName());
        put(p, "url", d.getUrl());
        put(p, "user", d.getUser());
        setProperties(d, p);
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        p.store(out, "");
        return new String(out.toByteArray());
    } catch (final IOException e) {
        throw new OpenEJBRuntimeException(String.format("Cannot canonicalize the @DataSourceDefinition %s as a properties string", d.getName()));
    }
}
Also used : OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) Properties(java.util.Properties)

Aggregations

OpenEJBRuntimeException (org.apache.openejb.OpenEJBRuntimeException)55 IOException (java.io.IOException)20 OpenEJBException (org.apache.openejb.OpenEJBException)17 ArrayList (java.util.ArrayList)13 Properties (java.util.Properties)12 NamingException (javax.naming.NamingException)9 MalformedURLException (java.net.MalformedURLException)8 BeanContext (org.apache.openejb.BeanContext)8 ObjectStreamException (java.io.ObjectStreamException)6 URISyntaxException (java.net.URISyntaxException)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6 File (java.io.File)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 Method (java.lang.reflect.Method)4 URL (java.net.URL)4 ApplicationException (org.apache.openejb.ApplicationException)4 InvalidObjectException (java.io.InvalidObjectException)3 AccessException (java.rmi.AccessException)3 RemoteException (java.rmi.RemoteException)3