Skip to content

Commit 7976b5f

Browse files
committed
KYLIN-2361 revert again because ordered class loader is not guaranteed to work
1 parent f36b134 commit 7976b5f

File tree

8 files changed

+53
-436
lines changed

8 files changed

+53
-436
lines changed

build/deploy/context.xml

+26-20
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version='1.0' encoding='utf-8'?>
22
<!--
3-
Licensed to the Apache Software Foundation (ASF) under one or more
4-
contributor license agreements. See the NOTICE file distributed with
5-
this work for additional information regarding copyright ownership.
6-
The ASF licenses this file to You under the Apache License, Version 2.0
7-
(the "License"); you may not use this file except in compliance with
8-
the License. You may obtain a copy of the License at
9-
10-
http://www.apache.org/licenses/LICENSE-2.0
11-
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
See the License for the specific language governing permissions and
16-
limitations under the License.
17-
-->
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing, software
14+
~ distributed under the License is distributed on an "AS IS" BASIS,
15+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
~ See the License for the specific language governing permissions and
17+
~ limitations under the License.
18+
-->
1819
<!-- The contents of this file will be loaded for each web application -->
1920
<Context>
2021

21-
<!-- Default set of monitored resources. If one of these changes, the -->
22-
<!-- web application will be reloaded. -->
22+
<!-- Default set of monitored resources -->
2323
<WatchedResource>WEB-INF/web.xml</WatchedResource>
24-
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
2524

2625
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
2726
<!--
2827
<Manager pathname="" />
2928
-->
29+
30+
<!-- Uncomment this to enable Comet connection tacking (provides events
31+
on session expiration as well as webapp lifecycle) -->
32+
<!--
33+
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
34+
-->
35+
3036
<Loader loaderClass="org.apache.kylin.ext.CustomizedWebappClassloader"/>
31-
<JarScanner scanClassPath="false" />
37+
3238
</Context>

build/deploy/server.xml

+16-47
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version='1.0' encoding='utf-8'?>
22
<!--
33
Licensed to the Apache Software Foundation (ASF) under one or more
44
contributor license agreements. See the NOTICE file distributed with
@@ -20,12 +20,13 @@
2020
Documentation at /docs/config/server.html
2121
-->
2222
<Server port="9005" shutdown="SHUTDOWN">
23-
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
2423
<!-- Security listener. Documentation at /docs/config/listeners.html
2524
<Listener className="org.apache.catalina.security.SecurityListener" />
2625
-->
2726
<!--APR library loader. Documentation at /docs/apr.html -->
2827
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
28+
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
29+
<Listener className="org.apache.catalina.core.JasperListener" />
2930
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
3031
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
3132
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
@@ -61,61 +62,29 @@
6162

6263
<!-- A "Connector" represents an endpoint by which requests are received
6364
and responses are returned. Documentation at :
64-
Java HTTP Connector: /docs/config/http.html
65+
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
6566
Java AJP Connector: /docs/config/ajp.html
6667
APR (HTTP/AJP) Connector: /docs/apr.html
67-
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
68+
Define a non-SSL HTTP/1.1 Connector on port 8080
6869
-->
6970
<Connector port="7070" protocol="HTTP/1.1"
7071
connectionTimeout="20000"
71-
redirectPort="9443"
72+
redirectPort="7443"
7273
compression="on"
7374
compressionMinSize="2048"
7475
noCompressionUserAgents="gozilla,traviata"
7576
compressableMimeType="text/html,text/xml,text/javascript,application/javascript,application/json,text/css,text/plain"
7677
/>
7778
<!-- A "Connector" using the shared thread pool-->
78-
<!--
79-
<Connector executor="tomcatThreadPool"
80-
port="8080" protocol="HTTP/1.1"
81-
connectionTimeout="20000"
82-
redirectPort="8443" />
83-
-->
84-
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
85-
This connector uses the NIO implementation. The default
86-
SSLImplementation will depend on the presence of the APR/native
87-
library and the useOpenSSL attribute of the
88-
AprLifecycleListener.
89-
Either JSSE or OpenSSL style configuration may be used regardless of
90-
the SSLImplementation selected. JSSE style configuration is used below.
91-
-->
92-
<!--
93-
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
94-
maxThreads="150" SSLEnabled="true">
95-
<SSLHostConfig>
96-
<Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
97-
type="RSA" />
98-
</SSLHostConfig>
99-
</Connector>
100-
-->
101-
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
102-
This connector uses the APR/native implementation which always uses
103-
OpenSSL for TLS.
104-
Either JSSE or OpenSSL style configuration may be used. OpenSSL style
105-
configuration is used below.
106-
-->
107-
<!--
108-
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
109-
maxThreads="150" SSLEnabled="true" >
110-
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
111-
<SSLHostConfig>
112-
<Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
113-
certificateFile="conf/localhost-rsa-cert.pem"
114-
certificateChainFile="conf/localhost-rsa-chain.pem"
115-
type="RSA" />
116-
</SSLHostConfig>
117-
</Connector>
118-
-->
79+
<!-- Define a SSL HTTP/1.1 Connector on port 8443
80+
This connector uses the BIO implementation that requires the JSSE
81+
style configuration. When using the APR/native implementation, the
82+
OpenSSL style configuration is required as described in the APR/native
83+
documentation -->
84+
<Connector port="7443" protocol="org.apache.coyote.http11.Http11Protocol"
85+
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
86+
keystoreFile="conf/.keystore" keystorePass="changeit"
87+
clientAuth="false" sslProtocol="TLS" />
11988

12089
<!-- Define an AJP 1.3 Connector on port 8009 -->
12190
<Connector port="9009" protocol="AJP/1.3" redirectPort="9443" />
@@ -163,7 +132,7 @@
163132
Documentation at: /docs/config/valve.html
164133
Note: The pattern used is equivalent to using pattern="common" -->
165134
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
166-
prefix="localhost_access_log" suffix=".txt"
135+
prefix="localhost_access_log." suffix=".txt"
167136
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
168137

169138
</Host>

build/script/download-tomcat.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ if [[ `uname -a` =~ "Darwin" ]]; then
2727
alias md5cmd="md5 -q"
2828
fi
2929

30-
tomcat_pkg_version="8.5.9"
31-
tomcat_pkg_md5="b41270a64b7774c964e4bec813eea2ed"
30+
tomcat_pkg_version="7.0.69"
31+
tomcat_pkg_md5="10a071e5169a1a8b14ff35a0ad181052"
3232

3333
if [ ! -f "build/apache-tomcat-${tomcat_pkg_version}.tar.gz" ]
3434
then
3535
echo "no binary file found"
36-
wget --directory-prefix=build/ http://archive.apache.org/dist/tomcat/tomcat-8/v${tomcat_pkg_version}/bin/apache-tomcat-${tomcat_pkg_version}.tar.gz || echo "Download tomcat failed"
36+
wget --directory-prefix=build/ http://archive.apache.org/dist/tomcat/tomcat-7/v${tomcat_pkg_version}/bin/apache-tomcat-${tomcat_pkg_version}.tar.gz || echo "Download tomcat failed"
3737
else
3838
if [ `md5cmd build/apache-tomcat-${tomcat_pkg_version}.tar.gz | awk '{print $1}'` != "${tomcat_pkg_md5}" ]
3939
then
4040
echo "md5 check failed"
4141
rm build/apache-tomcat-${tomcat_pkg_version}.tar.gz
42-
wget --directory-prefix=build/ http://archive.apache.org/dist/tomcat/tomcat-8/v${tomcat_pkg_version}/bin/apache-tomcat-${tomcat_pkg_version}.tar.gz || echo "download tomcat failed"
42+
wget --directory-prefix=build/ http://archive.apache.org/dist/tomcat/tomcat-7/v${tomcat_pkg_version}/bin/apache-tomcat-${tomcat_pkg_version}.tar.gz || echo "download tomcat failed"
4343
fi
4444
fi
4545
unalias md5cmd

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
<cglib.version>3.2.4</cglib.version>
111111
<supercsv.version>2.4.0</supercsv.version>
112112
<cors.version>2.5</cors.version>
113-
<tomcat.version>8.5.9</tomcat.version>
113+
<tomcat.version>7.0.69</tomcat.version>
114114
<t-digest.version>3.1</t-digest.version>
115115

116116
<!-- REST Service -->

server/src/main/java/org/apache/kylin/rest/DebugTomcat.java

+1-9
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@
2121
import org.apache.catalina.Context;
2222
import org.apache.catalina.core.AprLifecycleListener;
2323
import org.apache.catalina.core.StandardServer;
24+
import org.apache.catalina.deploy.ErrorPage;
2425
import org.apache.catalina.startup.Tomcat;
2526
import org.apache.commons.lang3.StringUtils;
2627
import org.apache.hadoop.util.Shell;
2728
import org.apache.kylin.common.KylinConfig;
28-
import org.apache.tomcat.JarScanFilter;
29-
import org.apache.tomcat.JarScanType;
30-
import org.apache.tomcat.util.descriptor.web.ErrorPage;
3129

3230
import java.io.File;
3331
import java.lang.reflect.Field;
@@ -129,12 +127,6 @@ public static void main(String[] args) throws Exception {
129127
notFound.setLocation("/index.html");
130128
webContext.addErrorPage(notFound);
131129
webContext.addWelcomeFile("index.html");
132-
webContext.getJarScanner().setJarScanFilter(new JarScanFilter() {
133-
@Override
134-
public boolean check(JarScanType arg0, String arg1) {
135-
return false;
136-
}
137-
});
138130

139131
// tomcat start
140132
tomcat.start();

tomcat-ext/src/main/java/org/apache/kylin/ext/CustomizedWebappClassloader.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818

1919
package org.apache.kylin.ext;
2020

21+
import org.apache.catalina.loader.ParallelWebappClassLoader;
22+
2123
/**
2224
* simple extension to standard ParallelWebappClassLoader
2325
* the only difference is that CustomizedWebappClassloader is able to delegate more packages
2426
* to parent classloaders
2527
*/
26-
public class CustomizedWebappClassloader extends WebappOrderedClassLoader {
28+
public class CustomizedWebappClassloader extends ParallelWebappClassLoader {
2729
/**
2830
* Set of package names which are not allowed to be loaded from a webapp
2931
* class loader without delegating first.
@@ -43,7 +45,7 @@ public CustomizedWebappClassloader(ClassLoader parent) {
4345
* @param name class name
4446
* @return true if the class should be filtered
4547
*/
46-
protected boolean filter(String name, boolean isClassName) {
48+
protected boolean filter(String name) {
4749
if (name == null)
4850
return false;
4951

@@ -60,6 +62,6 @@ protected boolean filter(String name, boolean isClassName) {
6062
return true;
6163
}
6264

63-
return super.filter(name, isClassName);
65+
return super.filter(name);
6466
}
6567
}

0 commit comments

Comments
 (0)