Skip to content

Commit

Permalink
DRILL-6349: Drill JDBC driver fails on Java 1.9+ with NoClassDefFound…
Browse files Browse the repository at this point in the history
…Error: sun/misc/VM
  • Loading branch information
oleg-zinovev committed Nov 22, 2018
1 parent 9d62585 commit 43e64cf
Show file tree
Hide file tree
Showing 24 changed files with 348 additions and 294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Properties;
import java.util.concurrent.TimeUnit;

import io.netty.util.internal.PlatformDependent;
import org.apache.drill.common.exceptions.DrillConfigurationException;
import org.apache.drill.common.exceptions.UserException;
import org.apache.drill.common.scanner.ClassPathScanner;
Expand All @@ -46,7 +47,7 @@ public class DrillConfig extends NestedConfig {
private final ImmutableList<String> startupArguments;

@SuppressWarnings("restriction")
private static final long MAX_DIRECT_MEMORY = sun.misc.VM.maxDirectMemory();
private static final long MAX_DIRECT_MEMORY = PlatformDependent.maxDirectMemory();

@VisibleForTesting
public DrillConfig(Config config) {
Expand Down
2 changes: 1 addition & 1 deletion contrib/storage-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<!-- Because the JDBC tests are somewhat heavyweight, we only run them in the 'verify' phase -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<version>2.22.0</version>
<configuration>
<forkCount combine.self="override">1</forkCount>
<systemPropertyVariables>
Expand Down
11 changes: 11 additions & 0 deletions distribution/src/resources/drill-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ export DRILLBIT_CODE_CACHE_SIZE=${DRILLBIT_CODE_CACHE_SIZE:-"1G"}
export DRILLBIT_OPTS="-Xms$DRILL_HEAP -Xmx$DRILL_HEAP -XX:MaxDirectMemorySize=$DRILL_MAX_DIRECT_MEMORY"
export DRILLBIT_OPTS="$DRILLBIT_OPTS -XX:ReservedCodeCacheSize=$DRILLBIT_CODE_CACHE_SIZE -Ddrill.exec.enable-epoll=false"

# Check that java is newer than 1.8
"$JAVA" -version 2>&1 | grep "version" | egrep -e "1\.8" > /dev/null
if [ $? -gt 0 ]; then
# Allow reflective access on Java 9+
export DRILLBIT_OPTS="$DRILLBIT_OPTS --add-opens java.base/java.lang=ALL-UNNAMED"
export DRILLBIT_OPTS="$DRILLBIT_OPTS --add-opens java.base/sun.nio.ch=ALL-UNNAMED"
export DRILLBIT_OPTS="$DRILLBIT_OPTS --add-opens java.base/java.nio=ALL-UNNAMED"
export DRILLBIT_OPTS="$DRILLBIT_OPTS --add-opens java.security.jgss/sun.security.krb5=ALL-UNNAMED"
export DRILLBIT_OPTS="$DRILLBIT_OPTS --illegal-access=permit"
fi


# Under YARN, the log directory is usually YARN-provided. Replace any
# value that may have been set in drill-env.sh.
Expand Down

0 comments on commit 43e64cf

Please sign in to comment.