This is an automated email from the ASF dual-hosted git repository.
boaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new 5e503c0 DRILL-5990: Drill should not startup with JRE sourced java
executable
5e503c0 is described below
commit 5e503c0e90b349aa51d2828df39ae55a56ca0661
Author: Kunal Khatua <[email protected]>
AuthorDate: Mon May 21 14:19:53 2018 -0700
DRILL-5990: Drill should not startup with JRE sourced java executable
Currently, the check for the Java compiler is made only during query
execution.
This commit ensures that if the java executable used for instantiating the
Drillbit is from a JRE (i.e. the Java compiler is not available), the Drillbit
will fail with the exception reported in the logs:
```
Exception in thread "main"
org.apache.drill.exec.exception.DrillbitStartupException: JDK Java compiler not
available. Ensure Drill is running with the java executable from a JDK and not
a JRE
at org.apache.drill.exec.server.Drillbit.<init>(Drillbit.java:138)
at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:409)
at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:389)
at org.apache.drill.exec.server.Drillbit.main(Drillbit.java:385)
```
---
.../main/java/org/apache/drill/exec/server/Drillbit.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
index 626a551..7b1d617 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
@@ -20,6 +20,8 @@ package org.apache.drill.exec.server;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import javax.tools.ToolProvider;
+
import org.apache.drill.common.AutoCloseables;
import org.apache.drill.common.StackTrace;
import org.apache.drill.common.concurrent.ExtendedLatch;
@@ -130,6 +132,12 @@ public class Drillbit implements AutoCloseable {
final CaseInsensitiveMap<OptionDefinition> definitions,
final RemoteServiceSet serviceSet,
final ScanResult classpathScan) throws Exception {
+
+ //Must start up with access to JDK Compiler
+ if (ToolProvider.getSystemJavaCompiler() == null) {
+ throw new DrillbitStartupException("JDK Java compiler not available.
Ensure Drill is running with the java executable from a JDK and not a JRE");
+ }
+
gracePeriod = config.getInt(ExecConstants.GRACE_PERIOD);
final Stopwatch w = Stopwatch.createStarted();
logger.debug("Construction started.");
@@ -400,7 +408,11 @@ public class Drillbit implements AutoCloseable {
try {
bit = new Drillbit(config, validators, remoteServiceSet, classpathScan);
} catch (final Exception ex) {
- throw new DrillbitStartupException("Failure while initializing values in
Drillbit.", ex);
+ if (ex instanceof DrillbitStartupException) {
+ throw (DrillbitStartupException) ex;
+ } else {
+ throw new DrillbitStartupException("Failure while initializing values
in Drillbit.", ex);
+ }
}
try {
--
To stop receiving notification emails like this one, please contact
[email protected].