You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2014/09/22 16:30:55 UTC

Re: svn commit: r1626531 - in /ofbiz/trunk: framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java runtime/catalina/catalina-users.xml

HI Jacopo,

Why did you remove catalina-users.xml, Is it replaced by /tomcat-users.xml/ ? I remember I had to use catalina-users.xml with Geronimo. Of course it 
was in 2007 and it's maybe deprecated now?

Jacques

Le 21/09/2014 08:23, jacopoc@apache.org a écrit :
> Author: jacopoc
> Date: Sun Sep 21 06:23:57 2014
> New Revision: 1626531
>
> URL: http://svn.apache.org/r1626531
> Log:
> Further improvements to the way we use the Tomcat startup API: removed the deprecated (will be removed in Tomcat 8) memory realm (not really used in OFBiz) and a series of minor adjustments.
>
> Removed:
>      ofbiz/trunk/runtime/catalina/catalina-users.xml
> Modified:
>      ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>
> Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1626531&r1=1626530&r2=1626531&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original)
> +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Sun Sep 21 06:23:57 2014
> @@ -52,7 +52,6 @@ import org.apache.catalina.filters.Reque
>   import org.apache.catalina.ha.tcp.ReplicationValve;
>   import org.apache.catalina.ha.tcp.SimpleTcpCluster;
>   import org.apache.catalina.loader.WebappLoader;
> -import org.apache.catalina.realm.MemoryRealm;
>   import org.apache.catalina.startup.ContextConfig;
>   import org.apache.catalina.startup.Tomcat;
>   import org.apache.catalina.tribes.group.GroupChannel;
> @@ -185,9 +184,6 @@ public class CatalinaContainer implement
>           System.setProperty("catalina.useNaming", String.valueOf(useNaming));
>           tomcat = new Tomcat();
>           tomcat.setBaseDir(System.getProperty("ofbiz.home"));
> -        if (useNaming) {
> -            tomcat.enableNaming();
> -        }
>   
>           // https://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JRE_Memory_Leak_Prevention_Listener_-_org.apache.catalina.core.JreMemoryLeakPreventionListener
>           // <<The JRE Memory Leak Prevention Listener provides work-arounds for known places where the Java Runtime environment uses
> @@ -202,6 +198,9 @@ public class CatalinaContainer implement
>   
>           // configure JNDI in the StandardServer
>           StandardServer server = (StandardServer) tomcat.getServer();
> +        if (useNaming) {
> +            tomcat.enableNaming();
> +        }
>           try {
>               server.setGlobalNamingContext(new InitialContext());
>           } catch (NamingException e) {
> @@ -260,6 +259,7 @@ public class CatalinaContainer implement
>           String engineName = engineConfig.name;
>           String hostName = defaultHostProp.value;
>   
> +        tomcat.setHostname(hostName);
>           Engine engine = tomcat.getEngine();
>           engine.setName(engineName);
>   
> @@ -269,16 +269,9 @@ public class CatalinaContainer implement
>               engine.setJvmRoute(jvmRoute);
>           }
>   
> -        // create the default realm -- TODO: make this configurable
> -        String dbConfigPath = new File(System.getProperty("catalina.home"), "catalina-users.xml").getAbsolutePath();
> -        MemoryRealm realm = new MemoryRealm();
> -        realm.setPathname(dbConfigPath);
> -        engine.setRealm(realm);
> -
>           // create a default virtual host; others will be created as needed
> -        Host host = createHost(engine, hostName);
> -        engine.addChild(host);
> -        engine.setDefaultHost(hostName);
> +        Host host = tomcat.getHost();
> +        configureHost(host);
>   
>           // configure clustering
>           List<ContainerConfig.Container.Property> clusterProps = engineConfig.getPropertiesWithValue("cluster");
> @@ -346,23 +339,18 @@ public class CatalinaContainer implement
>           return engine;
>       }
>   
> -    private Host createHost(Engine engine, String hostName) throws ContainerException {
> -        Debug.logInfo("Adding Host " + hostName + " to " + engine, module);
> -        if (tomcat == null) {
> -            throw new ContainerException("Cannot create Host without Tomcat instance!");
> -        }
> -
> +    private static Host createHost(String hostName) {
>           Host host = new StandardHost();
> -        host.setAppBase(CATALINA_HOSTS_HOME);
>           host.setName(hostName);
> +        configureHost(host);
> +        return host;
> +    }
> +    private static void configureHost(Host host) {
> +        host.setAppBase(CATALINA_HOSTS_HOME);
>           host.setDeployOnStartup(false);
>           host.setBackgroundProcessorDelay(5);
>           host.setAutoDeploy(false);
> -        ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP)
> -                , "work" + File.separator + engine.getName() + File.separator + host.getName()).getAbsolutePath());
> -        host.setParent(engine);
> -
> -        return host;
> +        ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP), "work" + File.separator + host.getName()).getAbsolutePath());
>       }
>   
>       protected Cluster createCluster(ContainerConfig.Container.Property clusterProps, Host host) throws ContainerException {
> @@ -500,14 +488,13 @@ public class CatalinaContainer implement
>               if (childContainer instanceof Host) {
>                   host = (Host)childContainer;
>               } else {
> -                host = createHost(engine, hostName);
> +                host = createHost(hostName);
>                   engine.addChild(host);
>               }
>               while (vhi.hasNext()) {
>                   host.addAlias(vhi.next());
>               }
>           }
> -
>           return new Callable<Context>() {
>               public Context call() throws ContainerException, LifecycleException {
>                   StandardContext context = configureContext(engine, host, appInfo);
>
>
>


Re: svn commit: r1626531 - in /ofbiz/trunk: framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java runtime/catalina/catalina-users.xml

Posted by Jacques Le Roux <ja...@les7arts.com>.
I think I rather used the catalina-users.xml file with lambda Probe which is now discontinued http://www.lambdaprobe.org/
So we cant forget catalina-users.xml indeed

Jacques

Le 22/09/2014 17:18, Jacques Le Roux a écrit :
> I think I had to use it in conjunction with the security manager, but I have to double-check that, already 7 years...
>
> Jacques
>
> Le 22/09/2014 16:43, Jacopo Cappellato a écrit :
>> Hi Jacques,
>>
>> I know that the MemoryRealm is deprecated in Tomcat 7 and will be removed in Tomcat 8; since the catalina-users.xml file was only used by the 
>> MemoryRealm and since I couldn't find a good use case for it in OFBiz I have removed it. If you think it may be still useful in the context of 
>> OFBiz we can bring it back.
>>
>> Jacopo
>>
>> On Sep 22, 2014, at 4:30 PM, Jacques Le Roux <ja...@les7arts.com> wrote:
>>
>>> HI Jacopo,
>>>
>>> Why did you remove catalina-users.xml, Is it replaced by /tomcat-users.xml/ ? I remember I had to use catalina-users.xml with Geronimo. Of course 
>>> it was in 2007 and it's maybe deprecated now?
>>>
>>> Jacques
>>>
>>> Le 21/09/2014 08:23, jacopoc@apache.org a écrit :
>>>> Author: jacopoc
>>>> Date: Sun Sep 21 06:23:57 2014
>>>> New Revision: 1626531
>>>>
>>>> URL: http://svn.apache.org/r1626531
>>>> Log:
>>>> Further improvements to the way we use the Tomcat startup API: removed the deprecated (will be removed in Tomcat 8) memory realm (not really used 
>>>> in OFBiz) and a series of minor adjustments.
>>>>
>>>> Removed:
>>>>      ofbiz/trunk/runtime/catalina/catalina-users.xml
>>>> Modified:
>>>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>>>>
>>>> Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1626531&r1=1626530&r2=1626531&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original)
>>>> +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Sun Sep 21 06:23:57 2014
>>>> @@ -52,7 +52,6 @@ import org.apache.catalina.filters.Reque
>>>>   import org.apache.catalina.ha.tcp.ReplicationValve;
>>>>   import org.apache.catalina.ha.tcp.SimpleTcpCluster;
>>>>   import org.apache.catalina.loader.WebappLoader;
>>>> -import org.apache.catalina.realm.MemoryRealm;
>>>>   import org.apache.catalina.startup.ContextConfig;
>>>>   import org.apache.catalina.startup.Tomcat;
>>>>   import org.apache.catalina.tribes.group.GroupChannel;
>>>> @@ -185,9 +184,6 @@ public class CatalinaContainer implement
>>>>           System.setProperty("catalina.useNaming", String.valueOf(useNaming));
>>>>           tomcat = new Tomcat();
>>>> tomcat.setBaseDir(System.getProperty("ofbiz.home"));
>>>> -        if (useNaming) {
>>>> -            tomcat.enableNaming();
>>>> -        }
>>>>             // 
>>>> https://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JRE_Memory_Leak_Prevention_Listener_-_org.apache.catalina.core.JreMemoryLeakPreventionListener
>>>>           // <<The JRE Memory Leak Prevention Listener provides work-arounds for known places where the Java Runtime environment uses
>>>> @@ -202,6 +198,9 @@ public class CatalinaContainer implement
>>>>             // configure JNDI in the StandardServer
>>>>           StandardServer server = (StandardServer) tomcat.getServer();
>>>> +        if (useNaming) {
>>>> +            tomcat.enableNaming();
>>>> +        }
>>>>           try {
>>>>               server.setGlobalNamingContext(new InitialContext());
>>>>           } catch (NamingException e) {
>>>> @@ -260,6 +259,7 @@ public class CatalinaContainer implement
>>>>           String engineName = engineConfig.name;
>>>>           String hostName = defaultHostProp.value;
>>>>   +        tomcat.setHostname(hostName);
>>>>           Engine engine = tomcat.getEngine();
>>>>           engine.setName(engineName);
>>>>   @@ -269,16 +269,9 @@ public class CatalinaContainer implement
>>>>               engine.setJvmRoute(jvmRoute);
>>>>           }
>>>>   -        // create the default realm -- TODO: make this configurable
>>>> -        String dbConfigPath = new File(System.getProperty("catalina.home"), "catalina-users.xml").getAbsolutePath();
>>>> -        MemoryRealm realm = new MemoryRealm();
>>>> -        realm.setPathname(dbConfigPath);
>>>> -        engine.setRealm(realm);
>>>> -
>>>>           // create a default virtual host; others will be created as needed
>>>> -        Host host = createHost(engine, hostName);
>>>> -        engine.addChild(host);
>>>> -        engine.setDefaultHost(hostName);
>>>> +        Host host = tomcat.getHost();
>>>> +        configureHost(host);
>>>>             // configure clustering
>>>>           List<ContainerConfig.Container.Property> clusterProps = engineConfig.getPropertiesWithValue("cluster");
>>>> @@ -346,23 +339,18 @@ public class CatalinaContainer implement
>>>>           return engine;
>>>>       }
>>>>   -    private Host createHost(Engine engine, String hostName) throws ContainerException {
>>>> -        Debug.logInfo("Adding Host " + hostName + " to " + engine, module);
>>>> -        if (tomcat == null) {
>>>> -            throw new ContainerException("Cannot create Host without Tomcat instance!");
>>>> -        }
>>>> -
>>>> +    private static Host createHost(String hostName) {
>>>>           Host host = new StandardHost();
>>>> -        host.setAppBase(CATALINA_HOSTS_HOME);
>>>>           host.setName(hostName);
>>>> +        configureHost(host);
>>>> +        return host;
>>>> +    }
>>>> +    private static void configureHost(Host host) {
>>>> +        host.setAppBase(CATALINA_HOSTS_HOME);
>>>>           host.setDeployOnStartup(false);
>>>>           host.setBackgroundProcessorDelay(5);
>>>>           host.setAutoDeploy(false);
>>>> -        ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP)
>>>> -                , "work" + File.separator + engine.getName() + File.separator + host.getName()).getAbsolutePath());
>>>> -        host.setParent(engine);
>>>> -
>>>> -        return host;
>>>> +        ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP), "work" + File.separator + 
>>>> host.getName()).getAbsolutePath());
>>>>       }
>>>>         protected Cluster createCluster(ContainerConfig.Container.Property clusterProps, Host host) throws ContainerException {
>>>> @@ -500,14 +488,13 @@ public class CatalinaContainer implement
>>>>               if (childContainer instanceof Host) {
>>>>                   host = (Host)childContainer;
>>>>               } else {
>>>> -                host = createHost(engine, hostName);
>>>> +                host = createHost(hostName);
>>>>                   engine.addChild(host);
>>>>               }
>>>>               while (vhi.hasNext()) {
>>>>                   host.addAlias(vhi.next());
>>>>               }
>>>>           }
>>>> -
>>>>           return new Callable<Context>() {
>>>>               public Context call() throws ContainerException, LifecycleException {
>>>>                   StandardContext context = configureContext(engine, host, appInfo);
>>>>
>>>>
>>>>
>>
>>
>
>

Re: svn commit: r1626531 - in /ofbiz/trunk: framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java runtime/catalina/catalina-users.xml

Posted by Jacques Le Roux <ja...@les7arts.com>.
I think I had to use it in conjunction with the security manager, but I have to double-check that, already 7 years...

Jacques

Le 22/09/2014 16:43, Jacopo Cappellato a écrit :
> Hi Jacques,
>
> I know that the MemoryRealm is deprecated in Tomcat 7 and will be removed in Tomcat 8; since the catalina-users.xml file was only used by the MemoryRealm and since I couldn't find a good use case for it in OFBiz I have removed it. If you think it may be still useful in the context of OFBiz we can bring it back.
>
> Jacopo
>
> On Sep 22, 2014, at 4:30 PM, Jacques Le Roux <ja...@les7arts.com> wrote:
>
>> HI Jacopo,
>>
>> Why did you remove catalina-users.xml, Is it replaced by /tomcat-users.xml/ ? I remember I had to use catalina-users.xml with Geronimo. Of course it was in 2007 and it's maybe deprecated now?
>>
>> Jacques
>>
>> Le 21/09/2014 08:23, jacopoc@apache.org a écrit :
>>> Author: jacopoc
>>> Date: Sun Sep 21 06:23:57 2014
>>> New Revision: 1626531
>>>
>>> URL: http://svn.apache.org/r1626531
>>> Log:
>>> Further improvements to the way we use the Tomcat startup API: removed the deprecated (will be removed in Tomcat 8) memory realm (not really used in OFBiz) and a series of minor adjustments.
>>>
>>> Removed:
>>>      ofbiz/trunk/runtime/catalina/catalina-users.xml
>>> Modified:
>>>      ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>>>
>>> Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1626531&r1=1626530&r2=1626531&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original)
>>> +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Sun Sep 21 06:23:57 2014
>>> @@ -52,7 +52,6 @@ import org.apache.catalina.filters.Reque
>>>   import org.apache.catalina.ha.tcp.ReplicationValve;
>>>   import org.apache.catalina.ha.tcp.SimpleTcpCluster;
>>>   import org.apache.catalina.loader.WebappLoader;
>>> -import org.apache.catalina.realm.MemoryRealm;
>>>   import org.apache.catalina.startup.ContextConfig;
>>>   import org.apache.catalina.startup.Tomcat;
>>>   import org.apache.catalina.tribes.group.GroupChannel;
>>> @@ -185,9 +184,6 @@ public class CatalinaContainer implement
>>>           System.setProperty("catalina.useNaming", String.valueOf(useNaming));
>>>           tomcat = new Tomcat();
>>>           tomcat.setBaseDir(System.getProperty("ofbiz.home"));
>>> -        if (useNaming) {
>>> -            tomcat.enableNaming();
>>> -        }
>>>             // https://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JRE_Memory_Leak_Prevention_Listener_-_org.apache.catalina.core.JreMemoryLeakPreventionListener
>>>           // <<The JRE Memory Leak Prevention Listener provides work-arounds for known places where the Java Runtime environment uses
>>> @@ -202,6 +198,9 @@ public class CatalinaContainer implement
>>>             // configure JNDI in the StandardServer
>>>           StandardServer server = (StandardServer) tomcat.getServer();
>>> +        if (useNaming) {
>>> +            tomcat.enableNaming();
>>> +        }
>>>           try {
>>>               server.setGlobalNamingContext(new InitialContext());
>>>           } catch (NamingException e) {
>>> @@ -260,6 +259,7 @@ public class CatalinaContainer implement
>>>           String engineName = engineConfig.name;
>>>           String hostName = defaultHostProp.value;
>>>   +        tomcat.setHostname(hostName);
>>>           Engine engine = tomcat.getEngine();
>>>           engine.setName(engineName);
>>>   @@ -269,16 +269,9 @@ public class CatalinaContainer implement
>>>               engine.setJvmRoute(jvmRoute);
>>>           }
>>>   -        // create the default realm -- TODO: make this configurable
>>> -        String dbConfigPath = new File(System.getProperty("catalina.home"), "catalina-users.xml").getAbsolutePath();
>>> -        MemoryRealm realm = new MemoryRealm();
>>> -        realm.setPathname(dbConfigPath);
>>> -        engine.setRealm(realm);
>>> -
>>>           // create a default virtual host; others will be created as needed
>>> -        Host host = createHost(engine, hostName);
>>> -        engine.addChild(host);
>>> -        engine.setDefaultHost(hostName);
>>> +        Host host = tomcat.getHost();
>>> +        configureHost(host);
>>>             // configure clustering
>>>           List<ContainerConfig.Container.Property> clusterProps = engineConfig.getPropertiesWithValue("cluster");
>>> @@ -346,23 +339,18 @@ public class CatalinaContainer implement
>>>           return engine;
>>>       }
>>>   -    private Host createHost(Engine engine, String hostName) throws ContainerException {
>>> -        Debug.logInfo("Adding Host " + hostName + " to " + engine, module);
>>> -        if (tomcat == null) {
>>> -            throw new ContainerException("Cannot create Host without Tomcat instance!");
>>> -        }
>>> -
>>> +    private static Host createHost(String hostName) {
>>>           Host host = new StandardHost();
>>> -        host.setAppBase(CATALINA_HOSTS_HOME);
>>>           host.setName(hostName);
>>> +        configureHost(host);
>>> +        return host;
>>> +    }
>>> +    private static void configureHost(Host host) {
>>> +        host.setAppBase(CATALINA_HOSTS_HOME);
>>>           host.setDeployOnStartup(false);
>>>           host.setBackgroundProcessorDelay(5);
>>>           host.setAutoDeploy(false);
>>> -        ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP)
>>> -                , "work" + File.separator + engine.getName() + File.separator + host.getName()).getAbsolutePath());
>>> -        host.setParent(engine);
>>> -
>>> -        return host;
>>> +        ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP), "work" + File.separator + host.getName()).getAbsolutePath());
>>>       }
>>>         protected Cluster createCluster(ContainerConfig.Container.Property clusterProps, Host host) throws ContainerException {
>>> @@ -500,14 +488,13 @@ public class CatalinaContainer implement
>>>               if (childContainer instanceof Host) {
>>>                   host = (Host)childContainer;
>>>               } else {
>>> -                host = createHost(engine, hostName);
>>> +                host = createHost(hostName);
>>>                   engine.addChild(host);
>>>               }
>>>               while (vhi.hasNext()) {
>>>                   host.addAlias(vhi.next());
>>>               }
>>>           }
>>> -
>>>           return new Callable<Context>() {
>>>               public Context call() throws ContainerException, LifecycleException {
>>>                   StandardContext context = configureContext(engine, host, appInfo);
>>>
>>>
>>>
>
>


Re: svn commit: r1626531 - in /ofbiz/trunk: framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java runtime/catalina/catalina-users.xml

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
Hi Jacques,

I know that the MemoryRealm is deprecated in Tomcat 7 and will be removed in Tomcat 8; since the catalina-users.xml file was only used by the MemoryRealm and since I couldn't find a good use case for it in OFBiz I have removed it. If you think it may be still useful in the context of OFBiz we can bring it back.

Jacopo

On Sep 22, 2014, at 4:30 PM, Jacques Le Roux <ja...@les7arts.com> wrote:

> HI Jacopo,
> 
> Why did you remove catalina-users.xml, Is it replaced by /tomcat-users.xml/ ? I remember I had to use catalina-users.xml with Geronimo. Of course it was in 2007 and it's maybe deprecated now?
> 
> Jacques
> 
> Le 21/09/2014 08:23, jacopoc@apache.org a écrit :
>> Author: jacopoc
>> Date: Sun Sep 21 06:23:57 2014
>> New Revision: 1626531
>> 
>> URL: http://svn.apache.org/r1626531
>> Log:
>> Further improvements to the way we use the Tomcat startup API: removed the deprecated (will be removed in Tomcat 8) memory realm (not really used in OFBiz) and a series of minor adjustments.
>> 
>> Removed:
>>     ofbiz/trunk/runtime/catalina/catalina-users.xml
>> Modified:
>>     ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>> 
>> Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1626531&r1=1626530&r2=1626531&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original)
>> +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Sun Sep 21 06:23:57 2014
>> @@ -52,7 +52,6 @@ import org.apache.catalina.filters.Reque
>>  import org.apache.catalina.ha.tcp.ReplicationValve;
>>  import org.apache.catalina.ha.tcp.SimpleTcpCluster;
>>  import org.apache.catalina.loader.WebappLoader;
>> -import org.apache.catalina.realm.MemoryRealm;
>>  import org.apache.catalina.startup.ContextConfig;
>>  import org.apache.catalina.startup.Tomcat;
>>  import org.apache.catalina.tribes.group.GroupChannel;
>> @@ -185,9 +184,6 @@ public class CatalinaContainer implement
>>          System.setProperty("catalina.useNaming", String.valueOf(useNaming));
>>          tomcat = new Tomcat();
>>          tomcat.setBaseDir(System.getProperty("ofbiz.home"));
>> -        if (useNaming) {
>> -            tomcat.enableNaming();
>> -        }
>>            // https://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JRE_Memory_Leak_Prevention_Listener_-_org.apache.catalina.core.JreMemoryLeakPreventionListener
>>          // <<The JRE Memory Leak Prevention Listener provides work-arounds for known places where the Java Runtime environment uses
>> @@ -202,6 +198,9 @@ public class CatalinaContainer implement
>>            // configure JNDI in the StandardServer
>>          StandardServer server = (StandardServer) tomcat.getServer();
>> +        if (useNaming) {
>> +            tomcat.enableNaming();
>> +        }
>>          try {
>>              server.setGlobalNamingContext(new InitialContext());
>>          } catch (NamingException e) {
>> @@ -260,6 +259,7 @@ public class CatalinaContainer implement
>>          String engineName = engineConfig.name;
>>          String hostName = defaultHostProp.value;
>>  +        tomcat.setHostname(hostName);
>>          Engine engine = tomcat.getEngine();
>>          engine.setName(engineName);
>>  @@ -269,16 +269,9 @@ public class CatalinaContainer implement
>>              engine.setJvmRoute(jvmRoute);
>>          }
>>  -        // create the default realm -- TODO: make this configurable
>> -        String dbConfigPath = new File(System.getProperty("catalina.home"), "catalina-users.xml").getAbsolutePath();
>> -        MemoryRealm realm = new MemoryRealm();
>> -        realm.setPathname(dbConfigPath);
>> -        engine.setRealm(realm);
>> -
>>          // create a default virtual host; others will be created as needed
>> -        Host host = createHost(engine, hostName);
>> -        engine.addChild(host);
>> -        engine.setDefaultHost(hostName);
>> +        Host host = tomcat.getHost();
>> +        configureHost(host);
>>            // configure clustering
>>          List<ContainerConfig.Container.Property> clusterProps = engineConfig.getPropertiesWithValue("cluster");
>> @@ -346,23 +339,18 @@ public class CatalinaContainer implement
>>          return engine;
>>      }
>>  -    private Host createHost(Engine engine, String hostName) throws ContainerException {
>> -        Debug.logInfo("Adding Host " + hostName + " to " + engine, module);
>> -        if (tomcat == null) {
>> -            throw new ContainerException("Cannot create Host without Tomcat instance!");
>> -        }
>> -
>> +    private static Host createHost(String hostName) {
>>          Host host = new StandardHost();
>> -        host.setAppBase(CATALINA_HOSTS_HOME);
>>          host.setName(hostName);
>> +        configureHost(host);
>> +        return host;
>> +    }
>> +    private static void configureHost(Host host) {
>> +        host.setAppBase(CATALINA_HOSTS_HOME);
>>          host.setDeployOnStartup(false);
>>          host.setBackgroundProcessorDelay(5);
>>          host.setAutoDeploy(false);
>> -        ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP)
>> -                , "work" + File.separator + engine.getName() + File.separator + host.getName()).getAbsolutePath());
>> -        host.setParent(engine);
>> -
>> -        return host;
>> +        ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP), "work" + File.separator + host.getName()).getAbsolutePath());
>>      }
>>        protected Cluster createCluster(ContainerConfig.Container.Property clusterProps, Host host) throws ContainerException {
>> @@ -500,14 +488,13 @@ public class CatalinaContainer implement
>>              if (childContainer instanceof Host) {
>>                  host = (Host)childContainer;
>>              } else {
>> -                host = createHost(engine, hostName);
>> +                host = createHost(hostName);
>>                  engine.addChild(host);
>>              }
>>              while (vhi.hasNext()) {
>>                  host.addAlias(vhi.next());
>>              }
>>          }
>> -
>>          return new Callable<Context>() {
>>              public Context call() throws ContainerException, LifecycleException {
>>                  StandardContext context = configureContext(engine, host, appInfo);
>> 
>> 
>> 
>