You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacopo Cappellato <ja...@gmail.com> on 2014/09/18 11:07:15 UTC

Please help testing the Tomcat connector configuration in the trunk

Hi all,

a few minutes ago with the commit below I have cleaned up the Tomcat connector configuration for the http, https and ajp connectors.
In theory the settings should be the same as before (apart for the max number of processing threads that is now larger because it is set to the default value of tomcat) but before this commit some of them were not set because of some bugs in the integration code.
Now that the bugs are fixed and the all the parameters are actually set in the connectors, I need your help to confirm that the behavior is still good.
I have tested the http and https connectors and they seem to work just fine.
I couldn't test the ajp connector: I would appreciate if you could test it and let me know if it still works (as I expect).

Thanks,

Jacopo

Begin forwarded message:

> From: jacopoc@apache.org
> Subject: svn commit: r1625919 - in /ofbiz/trunk/framework/catalina: ofbiz-component.xml src/org/ofbiz/catalina/container/CatalinaContainer.java
> Date: September 18, 2014 at 11:00:15 AM GMT+2
> To: commits@ofbiz.apache.org
> Reply-To: dev@ofbiz.apache.org
> 
> Author: jacopoc
> Date: Thu Sep 18 09:00:15 2014
> New Revision: 1625919
> 
> URL: http://svn.apache.org/r1625919
> Log:
> Simplified and improved the logic to setup the Tomcat connectors: the logic was overly complex and messed up (probably after all the various upgrades to new Tomcat versions), there were a series of parameters that could not be set, some hardcoded values, some old and no more used (by Tomcat) parameters.
> Improved the information logged about the actual parameters set for the connectors.
> Removed Javolution from CatalinaContainer.
> Cleaned up the connector configuration file: removed no more used parameters, commented out some parameters (that didn't change the default), commented out some parameters in order to use the Tomcat default values that may improve the performance (e.g. maxThreads in OFBiz was set to a lower value than the default one of newer Tomcat releases and this limits the throughput in default OFBiz setups), updated URLs to Tomcat documentation.
> 
> Modified:
>    ofbiz/trunk/framework/catalina/ofbiz-component.xml
>    ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> 
> Modified: ofbiz/trunk/framework/catalina/ofbiz-component.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/ofbiz-component.xml?rev=1625919&r1=1625918&r2=1625919&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/catalina/ofbiz-component.xml (original)
> +++ ofbiz/trunk/framework/catalina/ofbiz-component.xml Thu Sep 18 09:00:15 2014
> @@ -66,116 +66,83 @@ under the License.
>             <!-- <property name="ssl-accelerator-port" value="8443"/> -->
>             <property name="enable-cross-subdomain-sessions" value="false"/>
>         </property>
> -        <!-- all connectors support type, host, port, enable-lookups -->
>         <property name="ajp-connector" value="connector">
> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/ajp.html for reference -->
> -            <property name="allowTrace" value="false"/>
> -            <property name="emptySessionPath" value="false"/>
> -            <property name="enableLookups" value="true"/>
> -            <property name="maxPostSize" value="2097152"/>
> +            <!-- see http://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html for reference -->
> +            <property name="port" value="8009"/>
>             <property name="protocol" value="AJP/1.3"/>
> -            <property name="proxyName" value=""/>
> -            <property name="proxyPort" value=""/>
> -            <property name="redirectPort" value=""/>
>             <property name="scheme" value="http"/>
>             <property name="secure" value="false"/>
>             <property name="URIEncoding" value="UTF-8"/>
> -            <property name="useBodyEncodingForURI" value="false"/>
>             <property name="xpoweredBy" value="true"/>
> +            <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) -->
>             <!-- AJP/13 connector attributes -->
> -            <property name="address" value="0.0.0.0"/>
> -            <property name="backlog" value="10"/>
> -            <property name="maxSpareThreads" value="50"/>
> +            <!-- commented out because the values match the Tomcat defaults:
> +            <property name="tomcatAuthentication" value="true"/>
> +            <property name="allowTrace" value="false"/>
> +            <property name="maxPostSize" value="2097152"/>
> +            <property name="noCompressionUserAgents" value=""/>
> +            <property name="connectionLinger" value="-1"/>
> +            <property name="connectionTimeout" value="60000"/>
> +            <property name="maxHttpHeaderSize" value="8192"/>
> +            <property name="maxKeepAliveRequests" value="100"/>
>             <property name="maxThreads" value="200"/>
> -            <property name="minSpareThreads" value="4"/>
> -            <property name="port" value="8009"/>
> +            <property name="minSpareThreads" value="10"/>
> +            <property name="acceptCount" value="100"/>
> +            <property name="restrictedUserAgents" value=""/>
> +            <property name="socketBuffer" value="9000"/>
>             <property name="tcpNoDelay" value="true"/>
> -            <property name="soTimeout" value="60000"/>
> -            <property name="tomcatAuthentication" value="true"/>
> +            <property name="threadPriority" value="5"/>
> +            -->
>         </property>
>         <property name="http-connector" value="connector">
> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
> -            <property name="allowTrace" value="false"/>
> -            <property name="emptySessionPath" value="false"/>
> -            <property name="enableLookups" value="true"/>
> -            <property name="maxPostSize" value="2097152"/>
> +            <!-- see http://tomcat.apache.org/tomcat-7.0-doc/config/http.html for reference -->
> +            <property name="port" value="8080"/>
>             <property name="protocol" value="HTTP/1.1"/>
> -            <property name="proxyName" value=""/>
> -            <property name="proxyPort" value=""/>
> -            <property name="redirectPort" value=""/>
>             <property name="scheme" value="http"/>
>             <property name="secure" value="false"/>
>             <property name="URIEncoding" value="UTF-8"/>
> -            <property name="useBodyEncodingForURI" value="false"/>
>             <property name="xpoweredBy" value="true"/>
> -            <!-- HTTP connector attributes -->
> -            <property name="acceptCount" value="10"/>
> -            <property name="address" value="0.0.0.0"/>
> -            <property name="bufferSize" value="2048"/>
> +            <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) -->
>             <property name="compression" value="on"/>
>             <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
> +            <!-- commented out because the values match the Tomcat defaults:
> +            <property name="allowTrace" value="false"/>
> +            <property name="maxPostSize" value="2097152"/>
>             <property name="noCompressionUserAgents" value=""/>
>             <property name="connectionLinger" value="-1"/>
>             <property name="connectionTimeout" value="60000"/>
> -            <property name="disableUploadTimeout" value="false"/>
>             <property name="maxHttpHeaderSize" value="8192"/>
>             <property name="maxKeepAliveRequests" value="100"/>
> -            <property name="maxSpareThreads" value="50"/>
> -            <property name="maxThreads" value="100"/>
> -            <property name="minSpareThreads" value="4"/>
> -            <property name="port" value="8080"/>
> +            <property name="maxThreads" value="200"/>
> +            <property name="minSpareThreads" value="10"/>
> +            <property name="acceptCount" value="100"/>
>             <property name="restrictedUserAgents" value=""/>
> -            <property name="server" value=""/>
>             <property name="socketBuffer" value="9000"/>
> -            <property name="strategy" value="lf"/>
>             <property name="tcpNoDelay" value="true"/>
> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
> +            <property name="threadPriority" value="5"/>
> +            -->
>         </property>
>         <property name="https-connector" value="connector">
> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
> -            <property name="allowTrace" value="false"/>
> -            <property name="emptySessionPath" value="false"/>
> -            <property name="enableLookups" value="true"/>
> -            <property name="maxPostSize" value="2097152"/>
> +            <!-- see http://tomcat.apache.org/tomcat-7.0-doc/config/http.html for reference -->
> +            <property name="port" value="8443"/>
>             <property name="protocol" value="HTTP/1.1"/>
> -            <property name="proxyName" value=""/>
> -            <property name="proxyPort" value=""/>
> -            <property name="redirectPort" value=""/>
>             <property name="scheme" value="https"/>
>             <property name="secure" value="true"/>
> +            <property name="SSLEnabled" value="true"/>
>             <property name="URIEncoding" value="UTF-8"/>
> -            <property name="useBodyEncodingForURI" value="false"/>
>             <property name="xpoweredBy" value="true"/>
> -            <!-- HTTP connector attributes -->
> -            <property name="acceptCount" value="10"/>
> -            <property name="address" value="0.0.0.0"/>
> -            <property name="bufferSize" value="2048"/>
> +            <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) -->
>             <property name="compression" value="on"/>
>             <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
> -            <property name="noCompressionUserAgents" value=""/>
> -            <property name="connectionLinger" value="-1"/>
> -            <property name="connectionTimeout" value="60000"/>
> -            <property name="disableUploadTimeout" value="false"/>
> -            <property name="maxHttpHeaderSize" value="8192"/>
> -            <property name="maxKeepAliveRequests" value="100"/>
> -            <property name="maxSpareThreads" value="50"/>
> -            <property name="maxThreads" value="100"/>
> -            <property name="minSpareThreads" value="4"/>
> -            <property name="port" value="8443"/>
> -            <property name="restrictedUserAgents" value=""/>
> -            <property name="server" value=""/>
> -            <property name="socketBuffer" value="9000"/>
> -            <property name="strategy" value="lf"/>
> -            <property name="tcpNoDelay" value="true"/>
> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
>             <!-- SSL connector attributes -->
> -            <property name="sSLImplementation" value="org.ofbiz.catalina.container.SSLImpl"/>
> +            <property name="sslImplementationName" value="org.ofbiz.catalina.container.SSLImpl"/>
>             <property name="algorithm" value="SunX509"/>
>             <!-- the clientAuth to "want" in order to receive certs from the client;
>                 note that this isn't set this way by default because with certain browsers
>                 (like Safari) it breaks access via HTTPS, so until that problem is fixed
> -                the default will be false -->
> +                the default will be false
>             <property name="clientAuth" value="false"/>
> +            -->
>             <property name="keystoreFile" value="framework/base/config/ofbizssl.jks"/>
>             <property name="keystorePass" value="changeit"/>
>             <property name="keystoreType" value="JKS"/>
> @@ -202,133 +169,40 @@ under the License.
>             <property name="access-log-prefix" value="access_log."/>
>             <property name="access-log-dir" value="runtime/logs"/>
>             <property name="enable-request-dump" value="false"/>
> -            <!-- uncomment for cluster support
> -            <property name="default-server-cluster" value="cluster">
> -                <property name="rep-valve-filter">
> -                <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;.*\.png;.*\.css;.*\.ico;.*\.htc;</property-value>
> -                </property>
> -                <property name="manager-class" value="org.apache.catalina.cluster.session.DeltaManager"/>
> -                <property name="debug" value="5"/>
> -                <property name="replication-mode" value="org.apache.catalina.tribes.transport.bio.PooledMultiSender"/>
> -                <property name="tcp-listen-host" value="auto"/>
> -                <property name="tcp-listen-port" value="4001"/>
> -                <property name="tcp-sector-timeout" value="100"/>
> -                <property name="tcp-thread-count" value="6"/>
> -                <property name="mcast-bind-addr" value="192.168.2.1"/>
> -                <property name="mcast-addr" value="224.0.0.1"/>
> -                <property name="mcast-port" value="45564"/>
> -                <property name="mcast-freq" value="500"/>
> -                <property name="mcast-drop-time" value="3000"/>
> -            </property>
> -            -->
> -            <!-- <property name="ssl-accelerator-port" value="8443"/> -->
>         </property>
> -        <!-- all connectors support type, host, port, enable-lookups -->
>         <property name="ajp-connector" value="connector">
> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/ajp.html for reference -->
> -            <property name="allowTrace" value="false"/>
> -            <property name="emptySessionPath" value="false"/>
> -            <property name="enableLookups" value="true"/>
> -            <property name="maxPostSize" value="2097152"/>
> +            <property name="port" value="8010"/>
>             <property name="protocol" value="AJP/1.3"/>
> -            <property name="proxyName" value=""/>
> -            <property name="proxyPort" value=""/>
> -            <property name="redirectPort" value=""/>
>             <property name="scheme" value="http"/>
>             <property name="secure" value="false"/>
>             <property name="URIEncoding" value="UTF-8"/>
> -            <property name="useBodyEncodingForURI" value="false"/>
>             <property name="xpoweredBy" value="true"/>
> -            <!-- AJP/13 connector attributes -->
> -            <property name="address" value="0.0.0.0"/>
> -            <property name="backlog" value="10"/>
> -            <property name="maxSpareThreads" value="50"/>
> -            <property name="maxThreads" value="200"/>
> -            <property name="minSpareThreads" value="4"/>
> -            <property name="port" value="8010"/>
> -            <property name="tcpNoDelay" value="true"/>
> -            <property name="soTimeout" value="60000"/>
> -            <property name="tomcatAuthentication" value="true"/>
> +            <property name="enableLookups" value="true"/>
>         </property>
>         <property name="http-connector" value="connector">
> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
> -            <property name="allowTrace" value="false"/>
> -            <property name="emptySessionPath" value="false"/>
> -            <property name="enableLookups" value="true"/>
> -            <property name="maxPostSize" value="2097152"/>
> +            <property name="port" value="8080"/>
>             <property name="protocol" value="HTTP/1.1"/>
> -            <property name="proxyName" value=""/>
> -            <property name="proxyPort" value=""/>
> -            <property name="redirectPort" value=""/>
>             <property name="scheme" value="http"/>
>             <property name="secure" value="false"/>
>             <property name="URIEncoding" value="UTF-8"/>
> -            <property name="useBodyEncodingForURI" value="false"/>
>             <property name="xpoweredBy" value="true"/>
> -            <!-- HTTP connector attributes -->
> -            <property name="acceptCount" value="10"/>
> -            <property name="address" value="0.0.0.0"/>
> -            <property name="bufferSize" value="2048"/>
> -            <property name="compressableMimeType" value="text/html,text/xml,text/plain"/>
> +            <property name="enableLookups" value="true"/>
>             <property name="compression" value="on"/>
> -            <property name="connectionLinger" value="-1"/>
> -            <property name="connectionTimeout" value="60000"/>
> -            <property name="disableUploadTimeout" value="false"/>
> -            <property name="maxHttpHeaderSize" value="8192"/>
> -            <property name="maxKeepAliveRequests" value="100"/>
> -            <property name="maxSpareThreads" value="50"/>
> -            <property name="maxThreads" value="100"/>
> -            <property name="minSpareThreads" value="4"/>
> -            <property name="noCompressionUserAgents" value=""/>
> -            <property name="port" value="8080"/>
> -            <property name="restrictedUserAgents" value=""/>
> -            <property name="server" value=""/>
> -            <property name="socketBuffer" value="9000"/>
> -            <property name="strategy" value="lf"/>
> -            <property name="tcpNoDelay" value="true"/>
> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
> +            <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
>         </property>
>         <property name="https-connector" value="connector">
> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
> -            <property name="allowTrace" value="false"/>
> -            <property name="emptySessionPath" value="false"/>
> -            <property name="enableLookups" value="true"/>
> -            <property name="maxPostSize" value="2097152"/>
> +            <property name="port" value="8443"/>
>             <property name="protocol" value="HTTP/1.1"/>
> -            <property name="proxyName" value=""/>
> -            <property name="proxyPort" value=""/>
> -            <property name="redirectPort" value=""/>
>             <property name="scheme" value="https"/>
>             <property name="secure" value="true"/>
> +            <property name="SSLEnabled" value="true"/>
>             <property name="URIEncoding" value="UTF-8"/>
> -            <property name="useBodyEncodingForURI" value="false"/>
>             <property name="xpoweredBy" value="true"/>
> -            <!-- HTTP connector attributes -->
> -            <property name="acceptCount" value="10"/>
> -            <property name="address" value="0.0.0.0"/>
> -            <property name="bufferSize" value="2048"/>
> -            <property name="compressableMimeType" value="text/html,text/xml,text/plain"/>
> +            <property name="enableLookups" value="true"/>
>             <property name="compression" value="on"/>
> -            <property name="connectionLinger" value="-1"/>
> -            <property name="connectionTimeout" value="60000"/>
> -            <property name="disableUploadTimeout" value="false"/>
> -            <property name="maxHttpHeaderSize" value="8192"/>
> -            <property name="maxKeepAliveRequests" value="100"/>
> -            <property name="maxSpareThreads" value="50"/>
> -            <property name="maxThreads" value="100"/>
> -            <property name="minSpareThreads" value="4"/>
> -            <property name="noCompressionUserAgents" value=""/>
> -            <property name="port" value="8443"/>
> -            <property name="restrictedUserAgents" value=""/>
> -            <property name="server" value=""/>
> -            <property name="socketBuffer" value="9000"/>
> -            <property name="strategy" value="lf"/>
> -            <property name="tcpNoDelay" value="true"/>
> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
> -            <!-- SSL connector attributes -->
> -            <property name="sSLImplementation" value="org.ofbiz.catalina.container.SSLImpl"/>
> +            <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
> +            <property name="sslImplementationName" value="org.ofbiz.catalina.container.SSLImpl"/>
>             <property name="algorithm" value="SunX509"/>
> -            <property name="clientAuth" value="want"/>
>             <property name="keystoreFile" value="framework/base/config/ofbizssl.jks"/>
>             <property name="keystorePass" value="changeit"/>
>             <property name="keystoreType" value="JKS"/>
> 
> 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=1625919&r1=1625918&r2=1625919&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 Thu Sep 18 09:00:15 2014
> @@ -21,6 +21,7 @@ package org.ofbiz.catalina.container;
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URL;
> +import java.util.ArrayList;
> import java.util.HashMap;
> import java.util.Iterator;
> import java.util.List;
> @@ -32,8 +33,6 @@ import java.util.concurrent.ScheduledExe
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> 
> -import javolution.util.FastList;
> -
> import org.apache.catalina.Cluster;
> import org.apache.catalina.Context;
> import org.apache.catalina.Engine;
> @@ -63,8 +62,6 @@ import org.apache.catalina.tribes.transp
> import org.apache.catalina.tribes.transport.nio.NioReceiver;
> import org.apache.catalina.util.ServerInfo;
> import org.apache.catalina.valves.AccessLogValve;
> -import org.apache.coyote.ProtocolHandler;
> -import org.apache.coyote.http11.Http11Protocol;
> import org.apache.tomcat.JarScanner;
> import org.apache.tomcat.util.IntrospectionUtils;
> import org.apache.tomcat.util.scan.StandardJarScanner;
> @@ -236,25 +233,17 @@ public class CatalinaContainer implement
>         // load the web applications
>         loadComponents();
> 
> -        for (Connector con: tomcat.getService().findConnectors()) {
> -            ProtocolHandler ph = con.getProtocolHandler();
> -            int port = con.getPort();
> -            con.setAttribute("port", port);
> -            if (ph instanceof Http11Protocol) {
> -                Http11Protocol hph = (Http11Protocol) ph;
> -                Debug.logInfo("Connector " + hph.getName() + " @ " + hph.getPort() + " - " +
> -                    (hph.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
> -            } else {
> -                Debug.logInfo("Connector " + con.getProtocol() + " @ " + con.getPort() + " - " +
> -                    (con.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
> -            }
> -        }
>         // Start the Tomcat server
>         try {
>             tomcat.getServer().start();
>         } catch (LifecycleException e) {
>             throw new ContainerException(e);
>         }
> +
> +        for (Connector con: tomcat.getService().findConnectors()) {
> +            Debug.logInfo("Connector " + con.getProtocol() + " @ " + con.getPort() + " - " +
> +                (con.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
> +        }
>         Debug.logInfo("Started " + ServerInfo.getServerInfo(), module);
>         return true;
>     }
> @@ -473,87 +462,28 @@ public class CatalinaContainer implement
>         if (tomcat == null) {
>             throw new ContainerException("Cannot create Connector without Tomcat instance!");
>         }
> -
> -        // need some standard properties
> -        String protocol = ContainerConfig.getPropertyValue(connectorProp, "protocol", "HTTP/1.1");
> -        String address = ContainerConfig.getPropertyValue(connectorProp, "address", "0.0.0.0");
> -        int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0) + Start.getInstance().getConfig().portOffset;
> -
> -        boolean secure = ContainerConfig.getPropertyValue(connectorProp, "secure", false);
> -        if (protocol.toLowerCase().startsWith("ajp")) {
> -            protocol = "ajp";
> -        } else if ("memory".equals(protocol.toLowerCase())) {
> -            protocol = "memory";
> -        } else if (secure) {
> -            protocol = "https";
> -        } else {
> -            protocol = "http";
> -        }
> -
>         Connector connector = null;
>         if (UtilValidate.isNotEmpty(connectorProp.properties)) {
> -            if (address != null) {
> -                /*
> -                 * InetAddress.toString() returns a string of the form
> -                 * "<hostname>/<literal_IP>". Get the latter part, so that the
> -                 * address can be parsed (back) into an InetAddress using
> -                 * InetAddress.getByName().
> -                 */
> -                int index = address.indexOf('/');
> -                if (index != -1) {
> -                    address = address.substring(index + 1);
> -                }
> -            }
> +            String protocol = ContainerConfig.getPropertyValue(connectorProp, "protocol", "HTTP/1.1");
> +            int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0) + Start.getInstance().getConfig().portOffset;
> 
> -            Debug.logInfo("Creating connector for address='" +
> -                          ((address == null) ? "ALL" : address) +
> -                          "' port='" + port + "' protocol='" + protocol + "'", module);
> -
> -            try {
> -
> -                if (protocol.equals("ajp")) {
> -                    connector = new Connector("org.apache.coyote.ajp.AjpProtocol");
> -                } else if (protocol.equals("memory")) {
> -                    connector = new Connector("org.apache.coyote.memory.MemoryProtocolHandler");
> -                } else if (protocol.equals("http")) {
> -                    connector = new Connector();
> -                } else if (protocol.equals("https")) {
> -                    connector = new Connector();
> -                    connector.setScheme("https");
> -                    connector.setSecure(true);
> -                    connector.setProperty("SSLEnabled","true");
> -                    // FIXME !!!! SET SSL PROPERTIES
> -                } else {
> -                    connector = new Connector(protocol);
> +            // set the protocol and the port first
> +            connector = new Connector(protocol);
> +            connector.setPort(port);
> +            // then set all the other parameters
> +            for (ContainerConfig.Container.Property prop: connectorProp.properties.values()) {
> +                if ("protocol".equals(prop.name) || "port".equals(prop.name)) {
> +                    // protocol and port are already set
> +                    continue;
>                 }
> -
> -                if (address != null) {
> -                    IntrospectionUtils.setProperty(connector, "address", "" + address);
> +                if (IntrospectionUtils.setProperty(connector, prop.name, prop.value)) {
> +                    Debug.logInfo("Tomcat " + connector + ": set " + prop.name + "=" + prop.value, module);
> +                } else {
> +                    Debug.logWarning("Tomcat " + connector + ": ignored parameter " + prop.name, module);
>                 }
> -                IntrospectionUtils.setProperty(connector, "port", "" + port);
> -
> -            } catch (Exception e) {
> -                Debug.logError(e, "Couldn't create connector.", module);
>             }
> 
> -            try {
> -                for (ContainerConfig.Container.Property prop: connectorProp.properties.values()) {
> -                    if ("port".equals(prop.name)) {
> -                        connector.setProperty(prop.name, "" + port);
> -                    } else {
> -                        connector.setProperty(prop.name, prop.value);
> -                        //connector.setAttribute(prop.name, prop.value);
> -                    }
> -                }
> -
> -                if (connectorProp.properties.containsKey("URIEncoding")) {
> -                    connector.setURIEncoding(connectorProp.properties.get("URIEncoding").value);
> -                }
> -
> -                tomcat.getService().addConnector(connector);
> -            } catch (Exception e) {
> -                throw new ContainerException(e);
> -            }
> +            tomcat.getService().addConnector(connector);
>         }
>         return connector;
>     }
> @@ -728,21 +658,21 @@ public class CatalinaContainer implement
> 
>         // load the applications
>         List<ComponentConfig.WebappInfo> webResourceInfos = ComponentConfig.getAllWebappResourceInfos();
> -        List<String> loadedMounts = FastList.newInstance();
> +        List<String> loadedMounts = new ArrayList<String>();
>         if (webResourceInfos == null) {
>             return;
>         }
> 
>         ScheduledExecutorService executor = ExecutionPool.getScheduledExecutor(CATALINA_THREAD_GROUP, "catalina-startup", -1, true);
>         try {
> -            List<Future<Context>> futures = FastList.newInstance();
> +            List<Future<Context>> futures = new ArrayList<Future<Context>>();
> 
>             for (int i = webResourceInfos.size(); i > 0; i--) {
>                 ComponentConfig.WebappInfo appInfo = webResourceInfos.get(i - 1);
>                 String engineName = appInfo.server;
>                 List<String> virtualHosts = appInfo.getVirtualHosts();
>                 String mount = appInfo.getContextRoot();
> -                List<String> keys = FastList.newInstance();
> +                List<String> keys = new ArrayList<String>();
>                 if (virtualHosts.isEmpty()) {
>                     keys.add(engineName + ":DEFAULT:" + mount);
>                 } else {
> 
> 


Re: Please help testing the Tomcat connector configuration in the trunk

Posted by Jacopo Cappellato <ja...@gmail.com>.
Thank you Arun,

much appreciated!

Jacopo

On Sep 19, 2014, at 12:19 PM, Arun Patidar <ar...@hotwaxmedia.com> wrote:

> Hi Jacopo,
> 
> We have tested ajp connector and it seem to be working fine.
> 
> Thanks & Regards
> ---
> Arun Patidar
> 
> On Thursday 18 September 2014 02:37 PM, Jacopo Cappellato wrote:
>> Hi all,
>> 
>> a few minutes ago with the commit below I have cleaned up the Tomcat connector configuration for the http, https and ajp connectors.
>> In theory the settings should be the same as before (apart for the max number of processing threads that is now larger because it is set to the default value of tomcat) but before this commit some of them were not set because of some bugs in the integration code.
>> Now that the bugs are fixed and the all the parameters are actually set in the connectors, I need your help to confirm that the behavior is still good.
>> I have tested the http and https connectors and they seem to work just fine.
>> I couldn't test the ajp connector: I would appreciate if you could test it and let me know if it still works (as I expect).
>> 
>> Thanks,
>> 
>> Jacopo
>> 
>> Begin forwarded message:
>> 
>>> From: jacopoc@apache.org
>>> Subject: svn commit: r1625919 - in /ofbiz/trunk/framework/catalina: ofbiz-component.xml src/org/ofbiz/catalina/container/CatalinaContainer.java
>>> Date: September 18, 2014 at 11:00:15 AM GMT+2
>>> To: commits@ofbiz.apache.org
>>> Reply-To: dev@ofbiz.apache.org
>>> 
>>> Author: jacopoc
>>> Date: Thu Sep 18 09:00:15 2014
>>> New Revision: 1625919
>>> 
>>> URL: http://svn.apache.org/r1625919
>>> Log:
>>> Simplified and improved the logic to setup the Tomcat connectors: the logic was overly complex and messed up (probably after all the various upgrades to new Tomcat versions), there were a series of parameters that could not be set, some hardcoded values, some old and no more used (by Tomcat) parameters.
>>> Improved the information logged about the actual parameters set for the connectors.
>>> Removed Javolution from CatalinaContainer.
>>> Cleaned up the connector configuration file: removed no more used parameters, commented out some parameters (that didn't change the default), commented out some parameters in order to use the Tomcat default values that may improve the performance (e.g. maxThreads in OFBiz was set to a lower value than the default one of newer Tomcat releases and this limits the throughput in default OFBiz setups), updated URLs to Tomcat documentation.
>>> 
>>> Modified:
>>>    ofbiz/trunk/framework/catalina/ofbiz-component.xml
>>>    ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>>> 
>>> Modified: ofbiz/trunk/framework/catalina/ofbiz-component.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/ofbiz-component.xml?rev=1625919&r1=1625918&r2=1625919&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/catalina/ofbiz-component.xml (original)
>>> +++ ofbiz/trunk/framework/catalina/ofbiz-component.xml Thu Sep 18 09:00:15 2014
>>> @@ -66,116 +66,83 @@ under the License.
>>>             <!-- <property name="ssl-accelerator-port" value="8443"/> -->
>>>             <property name="enable-cross-subdomain-sessions" value="false"/>
>>>         </property>
>>> -        <!-- all connectors support type, host, port, enable-lookups -->
>>>         <property name="ajp-connector" value="connector">
>>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/ajp.html for reference -->
>>> -            <property name="allowTrace" value="false"/>
>>> -            <property name="emptySessionPath" value="false"/>
>>> -            <property name="enableLookups" value="true"/>
>>> -            <property name="maxPostSize" value="2097152"/>
>>> +            <!-- see http://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html for reference -->
>>> +            <property name="port" value="8009"/>
>>>             <property name="protocol" value="AJP/1.3"/>
>>> -            <property name="proxyName" value=""/>
>>> -            <property name="proxyPort" value=""/>
>>> -            <property name="redirectPort" value=""/>
>>>             <property name="scheme" value="http"/>
>>>             <property name="secure" value="false"/>
>>>             <property name="URIEncoding" value="UTF-8"/>
>>> -            <property name="useBodyEncodingForURI" value="false"/>
>>>             <property name="xpoweredBy" value="true"/>
>>> +            <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) -->
>>>             <!-- AJP/13 connector attributes -->
>>> -            <property name="address" value="0.0.0.0"/>
>>> -            <property name="backlog" value="10"/>
>>> -            <property name="maxSpareThreads" value="50"/>
>>> +            <!-- commented out because the values match the Tomcat defaults:
>>> +            <property name="tomcatAuthentication" value="true"/>
>>> +            <property name="allowTrace" value="false"/>
>>> +            <property name="maxPostSize" value="2097152"/>
>>> +            <property name="noCompressionUserAgents" value=""/>
>>> +            <property name="connectionLinger" value="-1"/>
>>> +            <property name="connectionTimeout" value="60000"/>
>>> +            <property name="maxHttpHeaderSize" value="8192"/>
>>> +            <property name="maxKeepAliveRequests" value="100"/>
>>>             <property name="maxThreads" value="200"/>
>>> -            <property name="minSpareThreads" value="4"/>
>>> -            <property name="port" value="8009"/>
>>> +            <property name="minSpareThreads" value="10"/>
>>> +            <property name="acceptCount" value="100"/>
>>> +            <property name="restrictedUserAgents" value=""/>
>>> +            <property name="socketBuffer" value="9000"/>
>>>             <property name="tcpNoDelay" value="true"/>
>>> -            <property name="soTimeout" value="60000"/>
>>> -            <property name="tomcatAuthentication" value="true"/>
>>> +            <property name="threadPriority" value="5"/>
>>> +            -->
>>>         </property>
>>>         <property name="http-connector" value="connector">
>>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
>>> -            <property name="allowTrace" value="false"/>
>>> -            <property name="emptySessionPath" value="false"/>
>>> -            <property name="enableLookups" value="true"/>
>>> -            <property name="maxPostSize" value="2097152"/>
>>> +            <!-- see http://tomcat.apache.org/tomcat-7.0-doc/config/http.html for reference -->
>>> +            <property name="port" value="8080"/>
>>>             <property name="protocol" value="HTTP/1.1"/>
>>> -            <property name="proxyName" value=""/>
>>> -            <property name="proxyPort" value=""/>
>>> -            <property name="redirectPort" value=""/>
>>>             <property name="scheme" value="http"/>
>>>             <property name="secure" value="false"/>
>>>             <property name="URIEncoding" value="UTF-8"/>
>>> -            <property name="useBodyEncodingForURI" value="false"/>
>>>             <property name="xpoweredBy" value="true"/>
>>> -            <!-- HTTP connector attributes -->
>>> -            <property name="acceptCount" value="10"/>
>>> -            <property name="address" value="0.0.0.0"/>
>>> -            <property name="bufferSize" value="2048"/>
>>> +            <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) -->
>>>             <property name="compression" value="on"/>
>>>             <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
>>> +            <!-- commented out because the values match the Tomcat defaults:
>>> +            <property name="allowTrace" value="false"/>
>>> +            <property name="maxPostSize" value="2097152"/>
>>>             <property name="noCompressionUserAgents" value=""/>
>>>             <property name="connectionLinger" value="-1"/>
>>>             <property name="connectionTimeout" value="60000"/>
>>> -            <property name="disableUploadTimeout" value="false"/>
>>>             <property name="maxHttpHeaderSize" value="8192"/>
>>>             <property name="maxKeepAliveRequests" value="100"/>
>>> -            <property name="maxSpareThreads" value="50"/>
>>> -            <property name="maxThreads" value="100"/>
>>> -            <property name="minSpareThreads" value="4"/>
>>> -            <property name="port" value="8080"/>
>>> +            <property name="maxThreads" value="200"/>
>>> +            <property name="minSpareThreads" value="10"/>
>>> +            <property name="acceptCount" value="100"/>
>>>             <property name="restrictedUserAgents" value=""/>
>>> -            <property name="server" value=""/>
>>>             <property name="socketBuffer" value="9000"/>
>>> -            <property name="strategy" value="lf"/>
>>>             <property name="tcpNoDelay" value="true"/>
>>> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
>>> +            <property name="threadPriority" value="5"/>
>>> +            -->
>>>         </property>
>>>         <property name="https-connector" value="connector">
>>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
>>> -            <property name="allowTrace" value="false"/>
>>> -            <property name="emptySessionPath" value="false"/>
>>> -            <property name="enableLookups" value="true"/>
>>> -            <property name="maxPostSize" value="2097152"/>
>>> +            <!-- see http://tomcat.apache.org/tomcat-7.0-doc/config/http.html for reference -->
>>> +            <property name="port" value="8443"/>
>>>             <property name="protocol" value="HTTP/1.1"/>
>>> -            <property name="proxyName" value=""/>
>>> -            <property name="proxyPort" value=""/>
>>> -            <property name="redirectPort" value=""/>
>>>             <property name="scheme" value="https"/>
>>>             <property name="secure" value="true"/>
>>> +            <property name="SSLEnabled" value="true"/>
>>>             <property name="URIEncoding" value="UTF-8"/>
>>> -            <property name="useBodyEncodingForURI" value="false"/>
>>>             <property name="xpoweredBy" value="true"/>
>>> -            <!-- HTTP connector attributes -->
>>> -            <property name="acceptCount" value="10"/>
>>> -            <property name="address" value="0.0.0.0"/>
>>> -            <property name="bufferSize" value="2048"/>
>>> +            <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) -->
>>>             <property name="compression" value="on"/>
>>>             <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
>>> -            <property name="noCompressionUserAgents" value=""/>
>>> -            <property name="connectionLinger" value="-1"/>
>>> -            <property name="connectionTimeout" value="60000"/>
>>> -            <property name="disableUploadTimeout" value="false"/>
>>> -            <property name="maxHttpHeaderSize" value="8192"/>
>>> -            <property name="maxKeepAliveRequests" value="100"/>
>>> -            <property name="maxSpareThreads" value="50"/>
>>> -            <property name="maxThreads" value="100"/>
>>> -            <property name="minSpareThreads" value="4"/>
>>> -            <property name="port" value="8443"/>
>>> -            <property name="restrictedUserAgents" value=""/>
>>> -            <property name="server" value=""/>
>>> -            <property name="socketBuffer" value="9000"/>
>>> -            <property name="strategy" value="lf"/>
>>> -            <property name="tcpNoDelay" value="true"/>
>>> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
>>>             <!-- SSL connector attributes -->
>>> -            <property name="sSLImplementation" value="org.ofbiz.catalina.container.SSLImpl"/>
>>> +            <property name="sslImplementationName" value="org.ofbiz.catalina.container.SSLImpl"/>
>>>             <property name="algorithm" value="SunX509"/>
>>>             <!-- the clientAuth to "want" in order to receive certs from the client;
>>>                 note that this isn't set this way by default because with certain browsers
>>>                 (like Safari) it breaks access via HTTPS, so until that problem is fixed
>>> -                the default will be false -->
>>> +                the default will be false
>>>             <property name="clientAuth" value="false"/>
>>> +            -->
>>>             <property name="keystoreFile" value="framework/base/config/ofbizssl.jks"/>
>>>             <property name="keystorePass" value="changeit"/>
>>>             <property name="keystoreType" value="JKS"/>
>>> @@ -202,133 +169,40 @@ under the License.
>>>             <property name="access-log-prefix" value="access_log."/>
>>>             <property name="access-log-dir" value="runtime/logs"/>
>>>             <property name="enable-request-dump" value="false"/>
>>> -            <!-- uncomment for cluster support
>>> -            <property name="default-server-cluster" value="cluster">
>>> -                <property name="rep-valve-filter">
>>> -                <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;.*\.png;.*\.css;.*\.ico;.*\.htc;</property-value>
>>> -                </property>
>>> -                <property name="manager-class" value="org.apache.catalina.cluster.session.DeltaManager"/>
>>> -                <property name="debug" value="5"/>
>>> -                <property name="replication-mode" value="org.apache.catalina.tribes.transport.bio.PooledMultiSender"/>
>>> -                <property name="tcp-listen-host" value="auto"/>
>>> -                <property name="tcp-listen-port" value="4001"/>
>>> -                <property name="tcp-sector-timeout" value="100"/>
>>> -                <property name="tcp-thread-count" value="6"/>
>>> -                <property name="mcast-bind-addr" value="192.168.2.1"/>
>>> -                <property name="mcast-addr" value="224.0.0.1"/>
>>> -                <property name="mcast-port" value="45564"/>
>>> -                <property name="mcast-freq" value="500"/>
>>> -                <property name="mcast-drop-time" value="3000"/>
>>> -            </property>
>>> -            -->
>>> -            <!-- <property name="ssl-accelerator-port" value="8443"/> -->
>>>         </property>
>>> -        <!-- all connectors support type, host, port, enable-lookups -->
>>>         <property name="ajp-connector" value="connector">
>>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/ajp.html for reference -->
>>> -            <property name="allowTrace" value="false"/>
>>> -            <property name="emptySessionPath" value="false"/>
>>> -            <property name="enableLookups" value="true"/>
>>> -            <property name="maxPostSize" value="2097152"/>
>>> +            <property name="port" value="8010"/>
>>>             <property name="protocol" value="AJP/1.3"/>
>>> -            <property name="proxyName" value=""/>
>>> -            <property name="proxyPort" value=""/>
>>> -            <property name="redirectPort" value=""/>
>>>             <property name="scheme" value="http"/>
>>>             <property name="secure" value="false"/>
>>>             <property name="URIEncoding" value="UTF-8"/>
>>> -            <property name="useBodyEncodingForURI" value="false"/>
>>>             <property name="xpoweredBy" value="true"/>
>>> -            <!-- AJP/13 connector attributes -->
>>> -            <property name="address" value="0.0.0.0"/>
>>> -            <property name="backlog" value="10"/>
>>> -            <property name="maxSpareThreads" value="50"/>
>>> -            <property name="maxThreads" value="200"/>
>>> -            <property name="minSpareThreads" value="4"/>
>>> -            <property name="port" value="8010"/>
>>> -            <property name="tcpNoDelay" value="true"/>
>>> -            <property name="soTimeout" value="60000"/>
>>> -            <property name="tomcatAuthentication" value="true"/>
>>> +            <property name="enableLookups" value="true"/>
>>>         </property>
>>>         <property name="http-connector" value="connector">
>>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
>>> -            <property name="allowTrace" value="false"/>
>>> -            <property name="emptySessionPath" value="false"/>
>>> -            <property name="enableLookups" value="true"/>
>>> -            <property name="maxPostSize" value="2097152"/>
>>> +            <property name="port" value="8080"/>
>>>             <property name="protocol" value="HTTP/1.1"/>
>>> -            <property name="proxyName" value=""/>
>>> -            <property name="proxyPort" value=""/>
>>> -            <property name="redirectPort" value=""/>
>>>             <property name="scheme" value="http"/>
>>>             <property name="secure" value="false"/>
>>>             <property name="URIEncoding" value="UTF-8"/>
>>> -            <property name="useBodyEncodingForURI" value="false"/>
>>>             <property name="xpoweredBy" value="true"/>
>>> -            <!-- HTTP connector attributes -->
>>> -            <property name="acceptCount" value="10"/>
>>> -            <property name="address" value="0.0.0.0"/>
>>> -            <property name="bufferSize" value="2048"/>
>>> -            <property name="compressableMimeType" value="text/html,text/xml,text/plain"/>
>>> +            <property name="enableLookups" value="true"/>
>>>             <property name="compression" value="on"/>
>>> -            <property name="connectionLinger" value="-1"/>
>>> -            <property name="connectionTimeout" value="60000"/>
>>> -            <property name="disableUploadTimeout" value="false"/>
>>> -            <property name="maxHttpHeaderSize" value="8192"/>
>>> -            <property name="maxKeepAliveRequests" value="100"/>
>>> -            <property name="maxSpareThreads" value="50"/>
>>> -            <property name="maxThreads" value="100"/>
>>> -            <property name="minSpareThreads" value="4"/>
>>> -            <property name="noCompressionUserAgents" value=""/>
>>> -            <property name="port" value="8080"/>
>>> -            <property name="restrictedUserAgents" value=""/>
>>> -            <property name="server" value=""/>
>>> -            <property name="socketBuffer" value="9000"/>
>>> -            <property name="strategy" value="lf"/>
>>> -            <property name="tcpNoDelay" value="true"/>
>>> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
>>> +            <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
>>>         </property>
>>>         <property name="https-connector" value="connector">
>>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
>>> -            <property name="allowTrace" value="false"/>
>>> -            <property name="emptySessionPath" value="false"/>
>>> -            <property name="enableLookups" value="true"/>
>>> -            <property name="maxPostSize" value="2097152"/>
>>> +            <property name="port" value="8443"/>
>>>             <property name="protocol" value="HTTP/1.1"/>
>>> -            <property name="proxyName" value=""/>
>>> -            <property name="proxyPort" value=""/>
>>> -            <property name="redirectPort" value=""/>
>>>             <property name="scheme" value="https"/>
>>>             <property name="secure" value="true"/>
>>> +            <property name="SSLEnabled" value="true"/>
>>>             <property name="URIEncoding" value="UTF-8"/>
>>> -            <property name="useBodyEncodingForURI" value="false"/>
>>>             <property name="xpoweredBy" value="true"/>
>>> -            <!-- HTTP connector attributes -->
>>> -            <property name="acceptCount" value="10"/>
>>> -            <property name="address" value="0.0.0.0"/>
>>> -            <property name="bufferSize" value="2048"/>
>>> -            <property name="compressableMimeType" value="text/html,text/xml,text/plain"/>
>>> +            <property name="enableLookups" value="true"/>
>>>             <property name="compression" value="on"/>
>>> -            <property name="connectionLinger" value="-1"/>
>>> -            <property name="connectionTimeout" value="60000"/>
>>> -            <property name="disableUploadTimeout" value="false"/>
>>> -            <property name="maxHttpHeaderSize" value="8192"/>
>>> -            <property name="maxKeepAliveRequests" value="100"/>
>>> -            <property name="maxSpareThreads" value="50"/>
>>> -            <property name="maxThreads" value="100"/>
>>> -            <property name="minSpareThreads" value="4"/>
>>> -            <property name="noCompressionUserAgents" value=""/>
>>> -            <property name="port" value="8443"/>
>>> -            <property name="restrictedUserAgents" value=""/>
>>> -            <property name="server" value=""/>
>>> -            <property name="socketBuffer" value="9000"/>
>>> -            <property name="strategy" value="lf"/>
>>> -            <property name="tcpNoDelay" value="true"/>
>>> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
>>> -            <!-- SSL connector attributes -->
>>> -            <property name="sSLImplementation" value="org.ofbiz.catalina.container.SSLImpl"/>
>>> +            <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
>>> +            <property name="sslImplementationName" value="org.ofbiz.catalina.container.SSLImpl"/>
>>>             <property name="algorithm" value="SunX509"/>
>>> -            <property name="clientAuth" value="want"/>
>>>             <property name="keystoreFile" value="framework/base/config/ofbizssl.jks"/>
>>>             <property name="keystorePass" value="changeit"/>
>>>             <property name="keystoreType" value="JKS"/>
>>> 
>>> 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=1625919&r1=1625918&r2=1625919&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 Thu Sep 18 09:00:15 2014
>>> @@ -21,6 +21,7 @@ package org.ofbiz.catalina.container;
>>> import java.io.File;
>>> import java.net.MalformedURLException;
>>> import java.net.URL;
>>> +import java.util.ArrayList;
>>> import java.util.HashMap;
>>> import java.util.Iterator;
>>> import java.util.List;
>>> @@ -32,8 +33,6 @@ import java.util.concurrent.ScheduledExe
>>> import javax.naming.InitialContext;
>>> import javax.naming.NamingException;
>>> 
>>> -import javolution.util.FastList;
>>> -
>>> import org.apache.catalina.Cluster;
>>> import org.apache.catalina.Context;
>>> import org.apache.catalina.Engine;
>>> @@ -63,8 +62,6 @@ import org.apache.catalina.tribes.transp
>>> import org.apache.catalina.tribes.transport.nio.NioReceiver;
>>> import org.apache.catalina.util.ServerInfo;
>>> import org.apache.catalina.valves.AccessLogValve;
>>> -import org.apache.coyote.ProtocolHandler;
>>> -import org.apache.coyote.http11.Http11Protocol;
>>> import org.apache.tomcat.JarScanner;
>>> import org.apache.tomcat.util.IntrospectionUtils;
>>> import org.apache.tomcat.util.scan.StandardJarScanner;
>>> @@ -236,25 +233,17 @@ public class CatalinaContainer implement
>>>         // load the web applications
>>>         loadComponents();
>>> 
>>> -        for (Connector con: tomcat.getService().findConnectors()) {
>>> -            ProtocolHandler ph = con.getProtocolHandler();
>>> -            int port = con.getPort();
>>> -            con.setAttribute("port", port);
>>> -            if (ph instanceof Http11Protocol) {
>>> -                Http11Protocol hph = (Http11Protocol) ph;
>>> -                Debug.logInfo("Connector " + hph.getName() + " @ " + hph.getPort() + " - " +
>>> -                    (hph.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
>>> -            } else {
>>> -                Debug.logInfo("Connector " + con.getProtocol() + " @ " + con.getPort() + " - " +
>>> -                    (con.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
>>> -            }
>>> -        }
>>>         // Start the Tomcat server
>>>         try {
>>>             tomcat.getServer().start();
>>>         } catch (LifecycleException e) {
>>>             throw new ContainerException(e);
>>>         }
>>> +
>>> +        for (Connector con: tomcat.getService().findConnectors()) {
>>> +            Debug.logInfo("Connector " + con.getProtocol() + " @ " + con.getPort() + " - " +
>>> +                (con.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
>>> +        }
>>>         Debug.logInfo("Started " + ServerInfo.getServerInfo(), module);
>>>         return true;
>>>     }
>>> @@ -473,87 +462,28 @@ public class CatalinaContainer implement
>>>         if (tomcat == null) {
>>>             throw new ContainerException("Cannot create Connector without Tomcat instance!");
>>>         }
>>> -
>>> -        // need some standard properties
>>> -        String protocol = ContainerConfig.getPropertyValue(connectorProp, "protocol", "HTTP/1.1");
>>> -        String address = ContainerConfig.getPropertyValue(connectorProp, "address", "0.0.0.0");
>>> -        int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0) + Start.getInstance().getConfig().portOffset;
>>> -
>>> -        boolean secure = ContainerConfig.getPropertyValue(connectorProp, "secure", false);
>>> -        if (protocol.toLowerCase().startsWith("ajp")) {
>>> -            protocol = "ajp";
>>> -        } else if ("memory".equals(protocol.toLowerCase())) {
>>> -            protocol = "memory";
>>> -        } else if (secure) {
>>> -            protocol = "https";
>>> -        } else {
>>> -            protocol = "http";
>>> -        }
>>> -
>>>         Connector connector = null;
>>>         if (UtilValidate.isNotEmpty(connectorProp.properties)) {
>>> -            if (address != null) {
>>> -                /*
>>> -                 * InetAddress.toString() returns a string of the form
>>> -                 * "<hostname>/<literal_IP>". Get the latter part, so that the
>>> -                 * address can be parsed (back) into an InetAddress using
>>> -                 * InetAddress.getByName().
>>> -                 */
>>> -                int index = address.indexOf('/');
>>> -                if (index != -1) {
>>> -                    address = address.substring(index + 1);
>>> -                }
>>> -            }
>>> +            String protocol = ContainerConfig.getPropertyValue(connectorProp, "protocol", "HTTP/1.1");
>>> +            int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0) + Start.getInstance().getConfig().portOffset;
>>> 
>>> -            Debug.logInfo("Creating connector for address='" +
>>> -                          ((address == null) ? "ALL" : address) +
>>> -                          "' port='" + port + "' protocol='" + protocol + "'", module);
>>> -
>>> -            try {
>>> -
>>> -                if (protocol.equals("ajp")) {
>>> -                    connector = new Connector("org.apache.coyote.ajp.AjpProtocol");
>>> -                } else if (protocol.equals("memory")) {
>>> -                    connector = new Connector("org.apache.coyote.memory.MemoryProtocolHandler");
>>> -                } else if (protocol.equals("http")) {
>>> -                    connector = new Connector();
>>> -                } else if (protocol.equals("https")) {
>>> -                    connector = new Connector();
>>> -                    connector.setScheme("https");
>>> -                    connector.setSecure(true);
>>> -                    connector.setProperty("SSLEnabled","true");
>>> -                    // FIXME !!!! SET SSL PROPERTIES
>>> -                } else {
>>> -                    connector = new Connector(protocol);
>>> +            // set the protocol and the port first
>>> +            connector = new Connector(protocol);
>>> +            connector.setPort(port);
>>> +            // then set all the other parameters
>>> +            for (ContainerConfig.Container.Property prop: connectorProp.properties.values()) {
>>> +                if ("protocol".equals(prop.name) || "port".equals(prop.name)) {
>>> +                    // protocol and port are already set
>>> +                    continue;
>>>                 }
>>> -
>>> -                if (address != null) {
>>> -                    IntrospectionUtils.setProperty(connector, "address", "" + address);
>>> +                if (IntrospectionUtils.setProperty(connector, prop.name, prop.value)) {
>>> +                    Debug.logInfo("Tomcat " + connector + ": set " + prop.name + "=" + prop.value, module);
>>> +                } else {
>>> +                    Debug.logWarning("Tomcat " + connector + ": ignored parameter " + prop.name, module);
>>>                 }
>>> -                IntrospectionUtils.setProperty(connector, "port", "" + port);
>>> -
>>> -            } catch (Exception e) {
>>> -                Debug.logError(e, "Couldn't create connector.", module);
>>>             }
>>> 
>>> -            try {
>>> -                for (ContainerConfig.Container.Property prop: connectorProp.properties.values()) {
>>> -                    if ("port".equals(prop.name)) {
>>> -                        connector.setProperty(prop.name, "" + port);
>>> -                    } else {
>>> -                        connector.setProperty(prop.name, prop.value);
>>> -                        //connector.setAttribute(prop.name, prop.value);
>>> -                    }
>>> -                }
>>> -
>>> -                if (connectorProp.properties.containsKey("URIEncoding")) {
>>> -                    connector.setURIEncoding(connectorProp.properties.get("URIEncoding").value);
>>> -                }
>>> -
>>> -                tomcat.getService().addConnector(connector);
>>> -            } catch (Exception e) {
>>> -                throw new ContainerException(e);
>>> -            }
>>> +            tomcat.getService().addConnector(connector);
>>>         }
>>>         return connector;
>>>     }
>>> @@ -728,21 +658,21 @@ public class CatalinaContainer implement
>>> 
>>>         // load the applications
>>>         List<ComponentConfig.WebappInfo> webResourceInfos = ComponentConfig.getAllWebappResourceInfos();
>>> -        List<String> loadedMounts = FastList.newInstance();
>>> +        List<String> loadedMounts = new ArrayList<String>();
>>>         if (webResourceInfos == null) {
>>>             return;
>>>         }
>>> 
>>>         ScheduledExecutorService executor = ExecutionPool.getScheduledExecutor(CATALINA_THREAD_GROUP, "catalina-startup", -1, true);
>>>         try {
>>> -            List<Future<Context>> futures = FastList.newInstance();
>>> +            List<Future<Context>> futures = new ArrayList<Future<Context>>();
>>> 
>>>             for (int i = webResourceInfos.size(); i > 0; i--) {
>>>                 ComponentConfig.WebappInfo appInfo = webResourceInfos.get(i - 1);
>>>                 String engineName = appInfo.server;
>>>                 List<String> virtualHosts = appInfo.getVirtualHosts();
>>>                 String mount = appInfo.getContextRoot();
>>> -                List<String> keys = FastList.newInstance();
>>> +                List<String> keys = new ArrayList<String>();
>>>                 if (virtualHosts.isEmpty()) {
>>>                     keys.add(engineName + ":DEFAULT:" + mount);
>>>                 } else {
>>> 
>>> 
> 


Re: Please help testing the Tomcat connector configuration in the trunk

Posted by Arun Patidar <ar...@hotwaxmedia.com>.
Hi Jacopo,

We have tested ajp connector and it seem to be working fine.

Thanks & Regards
---
Arun Patidar

On Thursday 18 September 2014 02:37 PM, Jacopo Cappellato wrote:
> Hi all,
>
> a few minutes ago with the commit below I have cleaned up the Tomcat connector configuration for the http, https and ajp connectors.
> In theory the settings should be the same as before (apart for the max number of processing threads that is now larger because it is set to the default value of tomcat) but before this commit some of them were not set because of some bugs in the integration code.
> Now that the bugs are fixed and the all the parameters are actually set in the connectors, I need your help to confirm that the behavior is still good.
> I have tested the http and https connectors and they seem to work just fine.
> I couldn't test the ajp connector: I would appreciate if you could test it and let me know if it still works (as I expect).
>
> Thanks,
>
> Jacopo
>
> Begin forwarded message:
>
>> From: jacopoc@apache.org
>> Subject: svn commit: r1625919 - in /ofbiz/trunk/framework/catalina: ofbiz-component.xml src/org/ofbiz/catalina/container/CatalinaContainer.java
>> Date: September 18, 2014 at 11:00:15 AM GMT+2
>> To: commits@ofbiz.apache.org
>> Reply-To: dev@ofbiz.apache.org
>>
>> Author: jacopoc
>> Date: Thu Sep 18 09:00:15 2014
>> New Revision: 1625919
>>
>> URL: http://svn.apache.org/r1625919
>> Log:
>> Simplified and improved the logic to setup the Tomcat connectors: the logic was overly complex and messed up (probably after all the various upgrades to new Tomcat versions), there were a series of parameters that could not be set, some hardcoded values, some old and no more used (by Tomcat) parameters.
>> Improved the information logged about the actual parameters set for the connectors.
>> Removed Javolution from CatalinaContainer.
>> Cleaned up the connector configuration file: removed no more used parameters, commented out some parameters (that didn't change the default), commented out some parameters in order to use the Tomcat default values that may improve the performance (e.g. maxThreads in OFBiz was set to a lower value than the default one of newer Tomcat releases and this limits the throughput in default OFBiz setups), updated URLs to Tomcat documentation.
>>
>> Modified:
>>     ofbiz/trunk/framework/catalina/ofbiz-component.xml
>>     ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>>
>> Modified: ofbiz/trunk/framework/catalina/ofbiz-component.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/ofbiz-component.xml?rev=1625919&r1=1625918&r2=1625919&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/catalina/ofbiz-component.xml (original)
>> +++ ofbiz/trunk/framework/catalina/ofbiz-component.xml Thu Sep 18 09:00:15 2014
>> @@ -66,116 +66,83 @@ under the License.
>>              <!-- <property name="ssl-accelerator-port" value="8443"/> -->
>>              <property name="enable-cross-subdomain-sessions" value="false"/>
>>          </property>
>> -        <!-- all connectors support type, host, port, enable-lookups -->
>>          <property name="ajp-connector" value="connector">
>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/ajp.html for reference -->
>> -            <property name="allowTrace" value="false"/>
>> -            <property name="emptySessionPath" value="false"/>
>> -            <property name="enableLookups" value="true"/>
>> -            <property name="maxPostSize" value="2097152"/>
>> +            <!-- see http://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html for reference -->
>> +            <property name="port" value="8009"/>
>>              <property name="protocol" value="AJP/1.3"/>
>> -            <property name="proxyName" value=""/>
>> -            <property name="proxyPort" value=""/>
>> -            <property name="redirectPort" value=""/>
>>              <property name="scheme" value="http"/>
>>              <property name="secure" value="false"/>
>>              <property name="URIEncoding" value="UTF-8"/>
>> -            <property name="useBodyEncodingForURI" value="false"/>
>>              <property name="xpoweredBy" value="true"/>
>> +            <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) -->
>>              <!-- AJP/13 connector attributes -->
>> -            <property name="address" value="0.0.0.0"/>
>> -            <property name="backlog" value="10"/>
>> -            <property name="maxSpareThreads" value="50"/>
>> +            <!-- commented out because the values match the Tomcat defaults:
>> +            <property name="tomcatAuthentication" value="true"/>
>> +            <property name="allowTrace" value="false"/>
>> +            <property name="maxPostSize" value="2097152"/>
>> +            <property name="noCompressionUserAgents" value=""/>
>> +            <property name="connectionLinger" value="-1"/>
>> +            <property name="connectionTimeout" value="60000"/>
>> +            <property name="maxHttpHeaderSize" value="8192"/>
>> +            <property name="maxKeepAliveRequests" value="100"/>
>>              <property name="maxThreads" value="200"/>
>> -            <property name="minSpareThreads" value="4"/>
>> -            <property name="port" value="8009"/>
>> +            <property name="minSpareThreads" value="10"/>
>> +            <property name="acceptCount" value="100"/>
>> +            <property name="restrictedUserAgents" value=""/>
>> +            <property name="socketBuffer" value="9000"/>
>>              <property name="tcpNoDelay" value="true"/>
>> -            <property name="soTimeout" value="60000"/>
>> -            <property name="tomcatAuthentication" value="true"/>
>> +            <property name="threadPriority" value="5"/>
>> +            -->
>>          </property>
>>          <property name="http-connector" value="connector">
>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
>> -            <property name="allowTrace" value="false"/>
>> -            <property name="emptySessionPath" value="false"/>
>> -            <property name="enableLookups" value="true"/>
>> -            <property name="maxPostSize" value="2097152"/>
>> +            <!-- see http://tomcat.apache.org/tomcat-7.0-doc/config/http.html for reference -->
>> +            <property name="port" value="8080"/>
>>              <property name="protocol" value="HTTP/1.1"/>
>> -            <property name="proxyName" value=""/>
>> -            <property name="proxyPort" value=""/>
>> -            <property name="redirectPort" value=""/>
>>              <property name="scheme" value="http"/>
>>              <property name="secure" value="false"/>
>>              <property name="URIEncoding" value="UTF-8"/>
>> -            <property name="useBodyEncodingForURI" value="false"/>
>>              <property name="xpoweredBy" value="true"/>
>> -            <!-- HTTP connector attributes -->
>> -            <property name="acceptCount" value="10"/>
>> -            <property name="address" value="0.0.0.0"/>
>> -            <property name="bufferSize" value="2048"/>
>> +            <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) -->
>>              <property name="compression" value="on"/>
>>              <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
>> +            <!-- commented out because the values match the Tomcat defaults:
>> +            <property name="allowTrace" value="false"/>
>> +            <property name="maxPostSize" value="2097152"/>
>>              <property name="noCompressionUserAgents" value=""/>
>>              <property name="connectionLinger" value="-1"/>
>>              <property name="connectionTimeout" value="60000"/>
>> -            <property name="disableUploadTimeout" value="false"/>
>>              <property name="maxHttpHeaderSize" value="8192"/>
>>              <property name="maxKeepAliveRequests" value="100"/>
>> -            <property name="maxSpareThreads" value="50"/>
>> -            <property name="maxThreads" value="100"/>
>> -            <property name="minSpareThreads" value="4"/>
>> -            <property name="port" value="8080"/>
>> +            <property name="maxThreads" value="200"/>
>> +            <property name="minSpareThreads" value="10"/>
>> +            <property name="acceptCount" value="100"/>
>>              <property name="restrictedUserAgents" value=""/>
>> -            <property name="server" value=""/>
>>              <property name="socketBuffer" value="9000"/>
>> -            <property name="strategy" value="lf"/>
>>              <property name="tcpNoDelay" value="true"/>
>> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
>> +            <property name="threadPriority" value="5"/>
>> +            -->
>>          </property>
>>          <property name="https-connector" value="connector">
>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
>> -            <property name="allowTrace" value="false"/>
>> -            <property name="emptySessionPath" value="false"/>
>> -            <property name="enableLookups" value="true"/>
>> -            <property name="maxPostSize" value="2097152"/>
>> +            <!-- see http://tomcat.apache.org/tomcat-7.0-doc/config/http.html for reference -->
>> +            <property name="port" value="8443"/>
>>              <property name="protocol" value="HTTP/1.1"/>
>> -            <property name="proxyName" value=""/>
>> -            <property name="proxyPort" value=""/>
>> -            <property name="redirectPort" value=""/>
>>              <property name="scheme" value="https"/>
>>              <property name="secure" value="true"/>
>> +            <property name="SSLEnabled" value="true"/>
>>              <property name="URIEncoding" value="UTF-8"/>
>> -            <property name="useBodyEncodingForURI" value="false"/>
>>              <property name="xpoweredBy" value="true"/>
>> -            <!-- HTTP connector attributes -->
>> -            <property name="acceptCount" value="10"/>
>> -            <property name="address" value="0.0.0.0"/>
>> -            <property name="bufferSize" value="2048"/>
>> +            <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) -->
>>              <property name="compression" value="on"/>
>>              <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
>> -            <property name="noCompressionUserAgents" value=""/>
>> -            <property name="connectionLinger" value="-1"/>
>> -            <property name="connectionTimeout" value="60000"/>
>> -            <property name="disableUploadTimeout" value="false"/>
>> -            <property name="maxHttpHeaderSize" value="8192"/>
>> -            <property name="maxKeepAliveRequests" value="100"/>
>> -            <property name="maxSpareThreads" value="50"/>
>> -            <property name="maxThreads" value="100"/>
>> -            <property name="minSpareThreads" value="4"/>
>> -            <property name="port" value="8443"/>
>> -            <property name="restrictedUserAgents" value=""/>
>> -            <property name="server" value=""/>
>> -            <property name="socketBuffer" value="9000"/>
>> -            <property name="strategy" value="lf"/>
>> -            <property name="tcpNoDelay" value="true"/>
>> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
>>              <!-- SSL connector attributes -->
>> -            <property name="sSLImplementation" value="org.ofbiz.catalina.container.SSLImpl"/>
>> +            <property name="sslImplementationName" value="org.ofbiz.catalina.container.SSLImpl"/>
>>              <property name="algorithm" value="SunX509"/>
>>              <!-- the clientAuth to "want" in order to receive certs from the client;
>>                  note that this isn't set this way by default because with certain browsers
>>                  (like Safari) it breaks access via HTTPS, so until that problem is fixed
>> -                the default will be false -->
>> +                the default will be false
>>              <property name="clientAuth" value="false"/>
>> +            -->
>>              <property name="keystoreFile" value="framework/base/config/ofbizssl.jks"/>
>>              <property name="keystorePass" value="changeit"/>
>>              <property name="keystoreType" value="JKS"/>
>> @@ -202,133 +169,40 @@ under the License.
>>              <property name="access-log-prefix" value="access_log."/>
>>              <property name="access-log-dir" value="runtime/logs"/>
>>              <property name="enable-request-dump" value="false"/>
>> -            <!-- uncomment for cluster support
>> -            <property name="default-server-cluster" value="cluster">
>> -                <property name="rep-valve-filter">
>> -                <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;.*\.png;.*\.css;.*\.ico;.*\.htc;</property-value>
>> -                </property>
>> -                <property name="manager-class" value="org.apache.catalina.cluster.session.DeltaManager"/>
>> -                <property name="debug" value="5"/>
>> -                <property name="replication-mode" value="org.apache.catalina.tribes.transport.bio.PooledMultiSender"/>
>> -                <property name="tcp-listen-host" value="auto"/>
>> -                <property name="tcp-listen-port" value="4001"/>
>> -                <property name="tcp-sector-timeout" value="100"/>
>> -                <property name="tcp-thread-count" value="6"/>
>> -                <property name="mcast-bind-addr" value="192.168.2.1"/>
>> -                <property name="mcast-addr" value="224.0.0.1"/>
>> -                <property name="mcast-port" value="45564"/>
>> -                <property name="mcast-freq" value="500"/>
>> -                <property name="mcast-drop-time" value="3000"/>
>> -            </property>
>> -            -->
>> -            <!-- <property name="ssl-accelerator-port" value="8443"/> -->
>>          </property>
>> -        <!-- all connectors support type, host, port, enable-lookups -->
>>          <property name="ajp-connector" value="connector">
>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/ajp.html for reference -->
>> -            <property name="allowTrace" value="false"/>
>> -            <property name="emptySessionPath" value="false"/>
>> -            <property name="enableLookups" value="true"/>
>> -            <property name="maxPostSize" value="2097152"/>
>> +            <property name="port" value="8010"/>
>>              <property name="protocol" value="AJP/1.3"/>
>> -            <property name="proxyName" value=""/>
>> -            <property name="proxyPort" value=""/>
>> -            <property name="redirectPort" value=""/>
>>              <property name="scheme" value="http"/>
>>              <property name="secure" value="false"/>
>>              <property name="URIEncoding" value="UTF-8"/>
>> -            <property name="useBodyEncodingForURI" value="false"/>
>>              <property name="xpoweredBy" value="true"/>
>> -            <!-- AJP/13 connector attributes -->
>> -            <property name="address" value="0.0.0.0"/>
>> -            <property name="backlog" value="10"/>
>> -            <property name="maxSpareThreads" value="50"/>
>> -            <property name="maxThreads" value="200"/>
>> -            <property name="minSpareThreads" value="4"/>
>> -            <property name="port" value="8010"/>
>> -            <property name="tcpNoDelay" value="true"/>
>> -            <property name="soTimeout" value="60000"/>
>> -            <property name="tomcatAuthentication" value="true"/>
>> +            <property name="enableLookups" value="true"/>
>>          </property>
>>          <property name="http-connector" value="connector">
>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
>> -            <property name="allowTrace" value="false"/>
>> -            <property name="emptySessionPath" value="false"/>
>> -            <property name="enableLookups" value="true"/>
>> -            <property name="maxPostSize" value="2097152"/>
>> +            <property name="port" value="8080"/>
>>              <property name="protocol" value="HTTP/1.1"/>
>> -            <property name="proxyName" value=""/>
>> -            <property name="proxyPort" value=""/>
>> -            <property name="redirectPort" value=""/>
>>              <property name="scheme" value="http"/>
>>              <property name="secure" value="false"/>
>>              <property name="URIEncoding" value="UTF-8"/>
>> -            <property name="useBodyEncodingForURI" value="false"/>
>>              <property name="xpoweredBy" value="true"/>
>> -            <!-- HTTP connector attributes -->
>> -            <property name="acceptCount" value="10"/>
>> -            <property name="address" value="0.0.0.0"/>
>> -            <property name="bufferSize" value="2048"/>
>> -            <property name="compressableMimeType" value="text/html,text/xml,text/plain"/>
>> +            <property name="enableLookups" value="true"/>
>>              <property name="compression" value="on"/>
>> -            <property name="connectionLinger" value="-1"/>
>> -            <property name="connectionTimeout" value="60000"/>
>> -            <property name="disableUploadTimeout" value="false"/>
>> -            <property name="maxHttpHeaderSize" value="8192"/>
>> -            <property name="maxKeepAliveRequests" value="100"/>
>> -            <property name="maxSpareThreads" value="50"/>
>> -            <property name="maxThreads" value="100"/>
>> -            <property name="minSpareThreads" value="4"/>
>> -            <property name="noCompressionUserAgents" value=""/>
>> -            <property name="port" value="8080"/>
>> -            <property name="restrictedUserAgents" value=""/>
>> -            <property name="server" value=""/>
>> -            <property name="socketBuffer" value="9000"/>
>> -            <property name="strategy" value="lf"/>
>> -            <property name="tcpNoDelay" value="true"/>
>> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
>> +            <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
>>          </property>
>>          <property name="https-connector" value="connector">
>> -            <!-- see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html for reference -->
>> -            <property name="allowTrace" value="false"/>
>> -            <property name="emptySessionPath" value="false"/>
>> -            <property name="enableLookups" value="true"/>
>> -            <property name="maxPostSize" value="2097152"/>
>> +            <property name="port" value="8443"/>
>>              <property name="protocol" value="HTTP/1.1"/>
>> -            <property name="proxyName" value=""/>
>> -            <property name="proxyPort" value=""/>
>> -            <property name="redirectPort" value=""/>
>>              <property name="scheme" value="https"/>
>>              <property name="secure" value="true"/>
>> +            <property name="SSLEnabled" value="true"/>
>>              <property name="URIEncoding" value="UTF-8"/>
>> -            <property name="useBodyEncodingForURI" value="false"/>
>>              <property name="xpoweredBy" value="true"/>
>> -            <!-- HTTP connector attributes -->
>> -            <property name="acceptCount" value="10"/>
>> -            <property name="address" value="0.0.0.0"/>
>> -            <property name="bufferSize" value="2048"/>
>> -            <property name="compressableMimeType" value="text/html,text/xml,text/plain"/>
>> +            <property name="enableLookups" value="true"/>
>>              <property name="compression" value="on"/>
>> -            <property name="connectionLinger" value="-1"/>
>> -            <property name="connectionTimeout" value="60000"/>
>> -            <property name="disableUploadTimeout" value="false"/>
>> -            <property name="maxHttpHeaderSize" value="8192"/>
>> -            <property name="maxKeepAliveRequests" value="100"/>
>> -            <property name="maxSpareThreads" value="50"/>
>> -            <property name="maxThreads" value="100"/>
>> -            <property name="minSpareThreads" value="4"/>
>> -            <property name="noCompressionUserAgents" value=""/>
>> -            <property name="port" value="8443"/>
>> -            <property name="restrictedUserAgents" value=""/>
>> -            <property name="server" value=""/>
>> -            <property name="socketBuffer" value="9000"/>
>> -            <property name="strategy" value="lf"/>
>> -            <property name="tcpNoDelay" value="true"/>
>> -            <property name="threadPriority" value="java.lang.Thread#NORM_PRIORITY"/>
>> -            <!-- SSL connector attributes -->
>> -            <property name="sSLImplementation" value="org.ofbiz.catalina.container.SSLImpl"/>
>> +            <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/>
>> +            <property name="sslImplementationName" value="org.ofbiz.catalina.container.SSLImpl"/>
>>              <property name="algorithm" value="SunX509"/>
>> -            <property name="clientAuth" value="want"/>
>>              <property name="keystoreFile" value="framework/base/config/ofbizssl.jks"/>
>>              <property name="keystorePass" value="changeit"/>
>>              <property name="keystoreType" value="JKS"/>
>>
>> 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=1625919&r1=1625918&r2=1625919&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 Thu Sep 18 09:00:15 2014
>> @@ -21,6 +21,7 @@ package org.ofbiz.catalina.container;
>> import java.io.File;
>> import java.net.MalformedURLException;
>> import java.net.URL;
>> +import java.util.ArrayList;
>> import java.util.HashMap;
>> import java.util.Iterator;
>> import java.util.List;
>> @@ -32,8 +33,6 @@ import java.util.concurrent.ScheduledExe
>> import javax.naming.InitialContext;
>> import javax.naming.NamingException;
>>
>> -import javolution.util.FastList;
>> -
>> import org.apache.catalina.Cluster;
>> import org.apache.catalina.Context;
>> import org.apache.catalina.Engine;
>> @@ -63,8 +62,6 @@ import org.apache.catalina.tribes.transp
>> import org.apache.catalina.tribes.transport.nio.NioReceiver;
>> import org.apache.catalina.util.ServerInfo;
>> import org.apache.catalina.valves.AccessLogValve;
>> -import org.apache.coyote.ProtocolHandler;
>> -import org.apache.coyote.http11.Http11Protocol;
>> import org.apache.tomcat.JarScanner;
>> import org.apache.tomcat.util.IntrospectionUtils;
>> import org.apache.tomcat.util.scan.StandardJarScanner;
>> @@ -236,25 +233,17 @@ public class CatalinaContainer implement
>>          // load the web applications
>>          loadComponents();
>>
>> -        for (Connector con: tomcat.getService().findConnectors()) {
>> -            ProtocolHandler ph = con.getProtocolHandler();
>> -            int port = con.getPort();
>> -            con.setAttribute("port", port);
>> -            if (ph instanceof Http11Protocol) {
>> -                Http11Protocol hph = (Http11Protocol) ph;
>> -                Debug.logInfo("Connector " + hph.getName() + " @ " + hph.getPort() + " - " +
>> -                    (hph.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
>> -            } else {
>> -                Debug.logInfo("Connector " + con.getProtocol() + " @ " + con.getPort() + " - " +
>> -                    (con.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
>> -            }
>> -        }
>>          // Start the Tomcat server
>>          try {
>>              tomcat.getServer().start();
>>          } catch (LifecycleException e) {
>>              throw new ContainerException(e);
>>          }
>> +
>> +        for (Connector con: tomcat.getService().findConnectors()) {
>> +            Debug.logInfo("Connector " + con.getProtocol() + " @ " + con.getPort() + " - " +
>> +                (con.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
>> +        }
>>          Debug.logInfo("Started " + ServerInfo.getServerInfo(), module);
>>          return true;
>>      }
>> @@ -473,87 +462,28 @@ public class CatalinaContainer implement
>>          if (tomcat == null) {
>>              throw new ContainerException("Cannot create Connector without Tomcat instance!");
>>          }
>> -
>> -        // need some standard properties
>> -        String protocol = ContainerConfig.getPropertyValue(connectorProp, "protocol", "HTTP/1.1");
>> -        String address = ContainerConfig.getPropertyValue(connectorProp, "address", "0.0.0.0");
>> -        int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0) + Start.getInstance().getConfig().portOffset;
>> -
>> -        boolean secure = ContainerConfig.getPropertyValue(connectorProp, "secure", false);
>> -        if (protocol.toLowerCase().startsWith("ajp")) {
>> -            protocol = "ajp";
>> -        } else if ("memory".equals(protocol.toLowerCase())) {
>> -            protocol = "memory";
>> -        } else if (secure) {
>> -            protocol = "https";
>> -        } else {
>> -            protocol = "http";
>> -        }
>> -
>>          Connector connector = null;
>>          if (UtilValidate.isNotEmpty(connectorProp.properties)) {
>> -            if (address != null) {
>> -                /*
>> -                 * InetAddress.toString() returns a string of the form
>> -                 * "<hostname>/<literal_IP>". Get the latter part, so that the
>> -                 * address can be parsed (back) into an InetAddress using
>> -                 * InetAddress.getByName().
>> -                 */
>> -                int index = address.indexOf('/');
>> -                if (index != -1) {
>> -                    address = address.substring(index + 1);
>> -                }
>> -            }
>> +            String protocol = ContainerConfig.getPropertyValue(connectorProp, "protocol", "HTTP/1.1");
>> +            int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0) + Start.getInstance().getConfig().portOffset;
>>
>> -            Debug.logInfo("Creating connector for address='" +
>> -                          ((address == null) ? "ALL" : address) +
>> -                          "' port='" + port + "' protocol='" + protocol + "'", module);
>> -
>> -            try {
>> -
>> -                if (protocol.equals("ajp")) {
>> -                    connector = new Connector("org.apache.coyote.ajp.AjpProtocol");
>> -                } else if (protocol.equals("memory")) {
>> -                    connector = new Connector("org.apache.coyote.memory.MemoryProtocolHandler");
>> -                } else if (protocol.equals("http")) {
>> -                    connector = new Connector();
>> -                } else if (protocol.equals("https")) {
>> -                    connector = new Connector();
>> -                    connector.setScheme("https");
>> -                    connector.setSecure(true);
>> -                    connector.setProperty("SSLEnabled","true");
>> -                    // FIXME !!!! SET SSL PROPERTIES
>> -                } else {
>> -                    connector = new Connector(protocol);
>> +            // set the protocol and the port first
>> +            connector = new Connector(protocol);
>> +            connector.setPort(port);
>> +            // then set all the other parameters
>> +            for (ContainerConfig.Container.Property prop: connectorProp.properties.values()) {
>> +                if ("protocol".equals(prop.name) || "port".equals(prop.name)) {
>> +                    // protocol and port are already set
>> +                    continue;
>>                  }
>> -
>> -                if (address != null) {
>> -                    IntrospectionUtils.setProperty(connector, "address", "" + address);
>> +                if (IntrospectionUtils.setProperty(connector, prop.name, prop.value)) {
>> +                    Debug.logInfo("Tomcat " + connector + ": set " + prop.name + "=" + prop.value, module);
>> +                } else {
>> +                    Debug.logWarning("Tomcat " + connector + ": ignored parameter " + prop.name, module);
>>                  }
>> -                IntrospectionUtils.setProperty(connector, "port", "" + port);
>> -
>> -            } catch (Exception e) {
>> -                Debug.logError(e, "Couldn't create connector.", module);
>>              }
>>
>> -            try {
>> -                for (ContainerConfig.Container.Property prop: connectorProp.properties.values()) {
>> -                    if ("port".equals(prop.name)) {
>> -                        connector.setProperty(prop.name, "" + port);
>> -                    } else {
>> -                        connector.setProperty(prop.name, prop.value);
>> -                        //connector.setAttribute(prop.name, prop.value);
>> -                    }
>> -                }
>> -
>> -                if (connectorProp.properties.containsKey("URIEncoding")) {
>> -                    connector.setURIEncoding(connectorProp.properties.get("URIEncoding").value);
>> -                }
>> -
>> -                tomcat.getService().addConnector(connector);
>> -            } catch (Exception e) {
>> -                throw new ContainerException(e);
>> -            }
>> +            tomcat.getService().addConnector(connector);
>>          }
>>          return connector;
>>      }
>> @@ -728,21 +658,21 @@ public class CatalinaContainer implement
>>
>>          // load the applications
>>          List<ComponentConfig.WebappInfo> webResourceInfos = ComponentConfig.getAllWebappResourceInfos();
>> -        List<String> loadedMounts = FastList.newInstance();
>> +        List<String> loadedMounts = new ArrayList<String>();
>>          if (webResourceInfos == null) {
>>              return;
>>          }
>>
>>          ScheduledExecutorService executor = ExecutionPool.getScheduledExecutor(CATALINA_THREAD_GROUP, "catalina-startup", -1, true);
>>          try {
>> -            List<Future<Context>> futures = FastList.newInstance();
>> +            List<Future<Context>> futures = new ArrayList<Future<Context>>();
>>
>>              for (int i = webResourceInfos.size(); i > 0; i--) {
>>                  ComponentConfig.WebappInfo appInfo = webResourceInfos.get(i - 1);
>>                  String engineName = appInfo.server;
>>                  List<String> virtualHosts = appInfo.getVirtualHosts();
>>                  String mount = appInfo.getContextRoot();
>> -                List<String> keys = FastList.newInstance();
>> +                List<String> keys = new ArrayList<String>();
>>                  if (virtualHosts.isEmpty()) {
>>                      keys.add(engineName + ":DEFAULT:" + mount);
>>                  } else {
>>
>>