Skip to content

Commit f58069d

Browse files
committed
PHOENIX-6861 PQS fails to start because of relocated javax.servlet with Phoenix 5.2
- make javax.servlet relocation a build time option controlled by a profile - update default phoenix version to 5.1.3 and HBase to 2.4.12 - add log4j2 logging test dependencies so that tests can be run with HBase 2.5
1 parent 434eae4 commit f58069d

File tree

5 files changed

+60
-10
lines changed

5 files changed

+60
-10
lines changed

.github/workflows/maven.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
with:
2929
java-version: 1.8
3030
- name: Build with Maven
31-
run: mvn -B clean install
31+
run: mvn -B clean install -Pshade-javax-servlet

BUILDING.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,26 @@ Copyright ©2020 [Apache Software Foundation](http://www.apache.org/). All Right
2626
This repository will build a tarball which is capable of running the Phoenix Query Server.
2727

2828
By default, this tarball does not contain a Phoenix client jar as it is meant to be agnostic
29-
of Phoenix version (one PQS release can be used against any Phoenix version). Today, PQS builds against
30-
the Phoenix 5.1.1 release with HBase 2.4.2.
29+
of Phoenix version (one PQS release should be usable against any Phoenix version).
30+
31+
However, due to an incompatible change in the relocations used in the phoenix-client JAR, you need to build
32+
Phoenix Query Server with the `shade-javax-servlet` maven profile if you use Phoenix versions
33+
5.1.1, 5.1.2, 5.1.3 or 4.16.x with it. (See PHOENIX-6861 for more details)
34+
This applies whether you bundle the Phoenix client into the assembly or add it separately.
35+
Phoenix 5.2.0 and later requires that PQS is built WITHOUT the `shade-javax-servlet` maven profile.
3136

3237
In order to use Phoenix Query Server, you need to copy the phoenix-client-embedded jar appropriate
3338
for your cluster into the Queryserver root directory.
3439

3540
Note that the resulting Query Server binaries are not tied to any Phoenix, Hbase or Hadoop versions,
36-
The current release requires at least Phoenix 4.16.0 or 5.1.0.
41+
apart from the exception above.
42+
43+
44+
```
45+
$ mvn clean package -Pshade-javax-servlet
46+
```
47+
48+
For other Phoenix versions build with the default settings
3749

3850
```
3951
$ mvn clean package
@@ -47,7 +59,7 @@ the `phoenix.client.artifactid` to choose the phoenix-client HBase variant.
4759
You need to bundle the embedded client variant, to avoid conflicts with the logging libraries.
4860

4961
```
50-
$ mvn clean package -Dpackage.phoenix.client -Dphoenix.version=5.1.1 -Dphoenix.client.artifactid=phoenix-client-embedded-hbase-2.4 -pl '!phoenix-queryserver-it'
62+
$ mvn clean package -Dpackage.phoenix.client -Dphoenix.version=5.1.1 -Dphoenix.client.artifactid=phoenix-client-embedded-hbase-2.4 -Pshade-javax-servlet -pl '!phoenix-queryserver-it'
5163
```
5264

5365
### Running integration tests

phoenix-queryserver-it/pom.xml

+10
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,16 @@
191191
<groupId>com.google.code.gson</groupId>
192192
<artifactId>gson</artifactId>
193193
<scope>test</scope>
194+
</dependency>
195+
<dependency>
196+
<groupId>org.apache.logging.log4j</groupId>
197+
<artifactId>log4j-api</artifactId>
198+
<scope>test</scope>
199+
</dependency>
200+
<dependency>
201+
<groupId>org.apache.logging.log4j</groupId>
202+
<artifactId>log4j-core</artifactId>
203+
<scope>test</scope>
194204
</dependency>
195205
</dependencies>
196206
</project>

phoenix-queryserver/pom.xml

+19-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<properties>
3939
<top.dir>${project.basedir}/..</top.dir>
4040
<shaded.package>org.apache.phoenix.shaded</shaded.package>
41+
<javax.servlet.package>dummy.disable.shading</javax.servlet.package>
4142
</properties>
4243

4344
<build>
@@ -130,8 +131,8 @@
130131
</filters>
131132
<relocations>
132133
<relocation>
133-
<pattern>javax.servlet</pattern>
134-
<shadedPattern>${shaded.package}.javax.servlet</shadedPattern>
134+
<pattern>${javax.servlet.package}</pattern>
135+
<shadedPattern>${shaded.package}.${javax.servlet.package}</shadedPattern>
135136
</relocation>
136137
<!-- Calcite/Avatica is not relocated because the wire API (as of <=1.8.0) expects
137138
consistent class names on client and server. Relocating these would break
@@ -245,4 +246,20 @@
245246
<scope>test</scope>
246247
</dependency>
247248
</dependencies>
249+
250+
<profiles>
251+
<profile>
252+
<!-- This is required for operation with Phoenix 5.1.0 - 5.1.3 and 4.16.x -->
253+
<!-- See PHOENIX-6861 -->
254+
<id>shade-javax-servlet</id>
255+
<activation>
256+
<property>
257+
<name>shade-javax-servlet</name>
258+
</property>
259+
</activation>
260+
<properties>
261+
<javax.servlet.package>javax.servlet</javax.servlet.package>
262+
</properties>
263+
</profile>
264+
</profiles>
248265
</project>

pom.xml

+14-3
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@
6868
<!-- General Properties -->
6969
<top.dir>${project.basedir}</top.dir>
7070

71-
<phoenix.version>5.1.1</phoenix.version>
71+
<phoenix.version>5.1.3</phoenix.version>
7272

7373
<!-- Hadoop/Hbase Versions -->
74-
<hbase.version>2.4.2</hbase.version>
74+
<hbase.version>2.4.15</hbase.version>
7575
<hadoop.version>3.1.4</hadoop.version>
76-
<phoenix.client.artifactid>phoenix-client-hbase-2.4</phoenix.client.artifactid>
76+
<phoenix.client.artifactid>phoenix-client-embedded-hbase-2.4</phoenix.client.artifactid>
7777

7878
<!-- Dependency versions -->
7979
<zookeeper.version>3.5.8</zookeeper.version>
@@ -89,6 +89,7 @@
8989
<avatica.version>1.23.0</avatica.version>
9090
<servlet.api.version>3.1.0</servlet.api.version>
9191
<jsr305.version>3.0.0</jsr305.version>
92+
<log4j2.version>2.19.0</log4j2.version>
9293

9394
<!-- Test Dependency versions -->
9495
<mockito-all.version>1.8.5</mockito-all.version>
@@ -692,6 +693,16 @@
692693
<version>140</version>
693694
<scope>test</scope>
694695
</dependency>
696+
<dependency>
697+
<groupId>org.apache.logging.log4j</groupId>
698+
<artifactId>log4j-api</artifactId>
699+
<version>${log4j2.version}</version>
700+
</dependency>
701+
<dependency>
702+
<groupId>org.apache.logging.log4j</groupId>
703+
<artifactId>log4j-core</artifactId>
704+
<version>${log4j2.version}</version>
705+
</dependency>
695706
</dependencies>
696707
</dependencyManagement>
697708
<profiles>

0 commit comments

Comments
 (0)