Skip to content

Commit 9dddcee

Browse files
committed
Update datanucleus for Java 11 compatibility
1 parent 31e56ea commit 9dddcee

File tree

3 files changed

+40
-18
lines changed

3 files changed

+40
-18
lines changed

pom.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
<commons-lang2.version>2.6</commons-lang2.version>
175175
<!-- org.apache.commons/commons-lang3/-->
176176
<commons-lang3.version>3.8.1</commons-lang3.version>
177-
<datanucleus-core.version>3.2.10</datanucleus-core.version>
177+
<datanucleus-core.version>5.2.0-release</datanucleus-core.version>
178178
<janino.version>3.0.11</janino.version>
179179
<jersey.version>2.22.2</jersey.version>
180180
<joda.version>2.9.3</joda.version>
@@ -1869,6 +1869,16 @@
18691869
<artifactId>datanucleus-core</artifactId>
18701870
<version>${datanucleus-core.version}</version>
18711871
</dependency>
1872+
<dependency>
1873+
<groupId>org.datanucleus</groupId>
1874+
<artifactId>datanucleus-api-jdo</artifactId>
1875+
<version>${datanucleus-core.version}</version>
1876+
</dependency>
1877+
<dependency>
1878+
<groupId>org.datanucleus</groupId>
1879+
<artifactId>datanucleus-rdbms</artifactId>
1880+
<version>${datanucleus-core.version}</version>
1881+
</dependency>
18721882
<dependency>
18731883
<groupId>org.apache.thrift</groupId>
18741884
<artifactId>libthrift</artifactId>

sql/hive/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@
157157
<dependency>
158158
<groupId>org.datanucleus</groupId>
159159
<artifactId>datanucleus-core</artifactId>
160+
<scope>runtime</scope>
161+
</dependency>
162+
<dependency>
163+
<groupId>org.datanucleus</groupId>
164+
<artifactId>datanucleus-api-jdo</artifactId>
165+
<scope>runtime</scope>
166+
</dependency>
167+
<dependency>
168+
<groupId>org.datanucleus</groupId>
169+
<artifactId>datanucleus-rdbms</artifactId>
170+
<scope>runtime</scope>
160171
</dependency>
161172
<dependency>
162173
<groupId>org.apache.thrift</groupId>

sql/hive/src/main/scala/org/apache/spark/sql/hive/client/IsolatedClientLoader.scala

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -210,25 +210,26 @@ private[hive] class IsolatedClientLoader(
210210
private[hive] val classLoader: MutableURLClassLoader = {
211211
val isolatedClassLoader =
212212
if (isolationOn) {
213-
val rootClassLoader: ClassLoader =
214-
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_9)) {
215-
// In Java 9, the boot classloader can see few JDK classes. The intended parent
216-
// classloader for delegation is now the platform classloader.
217-
// See http://java9.wtf/class-loading/
218-
val platformCL =
219-
classOf[ClassLoader].getMethod("getPlatformClassLoader").
220-
invoke(null).asInstanceOf[ClassLoader]
221-
// Check to make sure that the root classloader does not know about Hive.
222-
assert(Try(platformCL.loadClass("org.apache.hadoop.hive.conf.HiveConf")).isFailure)
223-
platformCL
224-
} else {
225-
// The boot classloader is represented by null (the instance itself isn't accessible)
226-
// and before Java 9 can see all JDK classes
227-
null
228-
}
229213
if (allJars.isEmpty) {
230-
rootClassLoader
214+
// See HiveUtils; this is the Java 9+ + builtin mode scenario
215+
baseClassLoader
231216
} else {
217+
val rootClassLoader: ClassLoader =
218+
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_9)) {
219+
// In Java 9, the boot classloader can see few JDK classes. The intended parent
220+
// classloader for delegation is now the platform classloader.
221+
// See http://java9.wtf/class-loading/
222+
val platformCL =
223+
classOf[ClassLoader].getMethod("getPlatformClassLoader").
224+
invoke(null).asInstanceOf[ClassLoader]
225+
// Check to make sure that the root classloader does not know about Hive.
226+
assert(Try(platformCL.loadClass("org.apache.hadoop.hive.conf.HiveConf")).isFailure)
227+
platformCL
228+
} else {
229+
// The boot classloader is represented by null (the instance itself isn't accessible)
230+
// and before Java 9 can see all JDK classes
231+
null
232+
}
232233
new URLClassLoader(allJars, rootClassLoader) {
233234
override def loadClass(name: String, resolve: Boolean): Class[_] = {
234235
val loaded = findLoadedClass(name)

0 commit comments

Comments
 (0)