Search in sources :

Example 6 with TomEERuntimeException

use of org.apache.tomee.catalina.TomEERuntimeException in project tomee by apache.

the class TomcatWsRegistry method removeWsContainer.

public void removeWsContainer(String path, final String moduleId) {
    if (path == null) {
        return;
    }
    // assure context root with a leading slash
    if (!path.startsWith("/")) {
        path = "/" + path;
    }
    if (TomcatHelper.isStopping()) {
        return;
    }
    Context context = webserviceContexts.remove(new Key(path, moduleId));
    if (context == null) {
        // fake
        context = webserviceContexts.remove(new Key(path, null));
    }
    // > 0 to avoid to destroy the context if not mandatory
    Integer refs = 1;
    if (context != null) {
        final String name = context.getName();
        refs = fakeContextReferences.remove(name);
        if (refs != null && refs > 0) {
            fakeContextReferences.put(name, refs - 1);
        }
    }
    if ((WEBSERVICE_OLDCONTEXT_ACTIVE || (refs != null && refs == 0)) && context != null) {
        try {
            context.stop();
            context.destroy();
        } catch (final Exception e) {
            throw new TomEERuntimeException(e);
        }
        final Host host = (Host) context.getParent();
        host.removeChild(context);
    }
// else let tomcat manages its context
}
Also used : Context(org.apache.catalina.Context) IgnoredStandardContext(org.apache.tomee.catalina.IgnoredStandardContext) StandardContext(org.apache.catalina.core.StandardContext) Host(org.apache.catalina.Host) URISyntaxException(java.net.URISyntaxException) TomEERuntimeException(org.apache.tomee.catalina.TomEERuntimeException) TomEERuntimeException(org.apache.tomee.catalina.TomEERuntimeException)

Aggregations

TomEERuntimeException (org.apache.tomee.catalina.TomEERuntimeException)6 IOException (java.io.IOException)4 MalformedURLException (java.net.MalformedURLException)3 Properties (java.util.Properties)3 LifecycleException (org.apache.catalina.LifecycleException)3 OpenEJBException (org.apache.openejb.OpenEJBException)3 File (java.io.File)2 NamingException (javax.naming.NamingException)2 Lifecycle (org.apache.catalina.Lifecycle)2 UndeployException (org.apache.openejb.UndeployException)2 PropertiesAdapter (org.apache.openejb.config.sys.PropertiesAdapter)2 ObjectRecipe (org.apache.xbean.recipe.ObjectRecipe)2 PropertyChangeListener (java.beans.PropertyChangeListener)1 URISyntaxException (java.net.URISyntaxException)1 URLClassLoader (java.net.URLClassLoader)1 ArrayList (java.util.ArrayList)1 Scanner (java.util.Scanner)1 EJBException (javax.ejb.EJBException)1 Bean (javax.enterprise.inject.spi.Bean)1 BeanManager (javax.enterprise.inject.spi.BeanManager)1