Thursday, May 4, 2017

Drill errors with "JDK Java compiler not available - probably you're running Drill with a JRE and not a JDK"

Symptom:

Drill query fails with error message:"JDK Java compiler not available - probably you're running Drill with a JRE and not a JDK".

Sample stacktrace is:
> select * from sys.options limit 1;
Error: SYSTEM ERROR: RuntimeException: JDK Java compiler not available - probably you're running Drill with a JRE and not a JDK

Fragment 0:0

[Error Id: 671967ea-5d72-4f65-a498-6f507a206358 on v7.poc.com:31010]

  (org.apache.drill.exec.exception.SchemaChangeException) Failure while attempting to load generated class
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.getGenerated2Copier():247
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.setupNewSchema():70
    org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():78
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext():93
    org.apache.drill.exec.record.AbstractRecordBatch.next():162
    org.apache.drill.exec.record.AbstractRecordBatch.next():119
    org.apache.drill.exec.record.AbstractRecordBatch.next():109
    org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
    org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():135
    org.apache.drill.exec.record.AbstractRecordBatch.next():162
    org.apache.drill.exec.physical.impl.BaseRootExec.next():104
    org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():81
    org.apache.drill.exec.physical.impl.BaseRootExec.next():94
    org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():232
    org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():226
    java.security.AccessController.doPrivileged():-2
    javax.security.auth.Subject.doAs():422
    org.apache.hadoop.security.UserGroupInformation.doAs():1595
    org.apache.drill.exec.work.fragment.FragmentExecutor.run():226
    org.apache.drill.common.SelfCleaningRunnable.run():38
    java.util.concurrent.ThreadPoolExecutor.runWorker():1142
    java.util.concurrent.ThreadPoolExecutor$Worker.run():617
    java.lang.Thread.run():745
  Caused By (org.apache.drill.exec.exception.ClassTransformationException) com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: JDK Java compiler not available - probably you're running Drill with a JRE and not a JDK
    org.apache.drill.exec.compile.CodeCompiler.createInstances():192
    org.apache.drill.exec.compile.CodeCompiler.createInstance():158
    org.apache.drill.exec.ops.FragmentContext.getImplementationClass():316
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.getGenerated2Copier():239
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.setupNewSchema():70
    org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():78
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext():93
    org.apache.drill.exec.record.AbstractRecordBatch.next():162
    org.apache.drill.exec.record.AbstractRecordBatch.next():119
    org.apache.drill.exec.record.AbstractRecordBatch.next():109
    org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
    org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():135
    org.apache.drill.exec.record.AbstractRecordBatch.next():162
    org.apache.drill.exec.physical.impl.BaseRootExec.next():104
    org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():81
    org.apache.drill.exec.physical.impl.BaseRootExec.next():94
    org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():232
    org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():226
    java.security.AccessController.doPrivileged():-2
    javax.security.auth.Subject.doAs():422
    org.apache.hadoop.security.UserGroupInformation.doAs():1595
    org.apache.drill.exec.work.fragment.FragmentExecutor.run():226
    org.apache.drill.common.SelfCleaningRunnable.run():38
    java.util.concurrent.ThreadPoolExecutor.runWorker():1142
    java.util.concurrent.ThreadPoolExecutor$Worker.run():617
    java.lang.Thread.run():745
  Caused By (com.google.common.util.concurrent.UncheckedExecutionException) java.lang.RuntimeException: JDK Java compiler not available - probably you're running Drill with a JRE and not a JDK
    com.google.common.cache.LocalCache$Segment.get():2203
    com.google.common.cache.LocalCache.get():3937
    com.google.common.cache.LocalCache.getOrLoad():3941
    com.google.common.cache.LocalCache$LocalLoadingCache.get():4824
    org.apache.drill.exec.compile.CodeCompiler.createInstances():181
    org.apache.drill.exec.compile.CodeCompiler.createInstance():158
    org.apache.drill.exec.ops.FragmentContext.getImplementationClass():316
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.getGenerated2Copier():239
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.setupNewSchema():70
    org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():78
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext():93
    org.apache.drill.exec.record.AbstractRecordBatch.next():162
    org.apache.drill.exec.record.AbstractRecordBatch.next():119
    org.apache.drill.exec.record.AbstractRecordBatch.next():109
    org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
    org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():135
    org.apache.drill.exec.record.AbstractRecordBatch.next():162
    org.apache.drill.exec.physical.impl.BaseRootExec.next():104
    org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():81
    org.apache.drill.exec.physical.impl.BaseRootExec.next():94
    org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():232
    org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():226
    java.security.AccessController.doPrivileged():-2
    javax.security.auth.Subject.doAs():422
    org.apache.hadoop.security.UserGroupInformation.doAs():1595
    org.apache.drill.exec.work.fragment.FragmentExecutor.run():226
    org.apache.drill.common.SelfCleaningRunnable.run():38
    java.util.concurrent.ThreadPoolExecutor.runWorker():1142
    java.util.concurrent.ThreadPoolExecutor$Worker.run():617
    java.lang.Thread.run():745
  Caused By (java.lang.RuntimeException) JDK Java compiler not available - probably you're running Drill with a JRE and not a JDK
    org.apache.drill.exec.compile.JDKClassCompiler.newInstance():48
    org.apache.drill.exec.compile.ClassCompilerSelector.<init>():115
    org.apache.drill.exec.compile.QueryClassLoader.<init>():49
    org.apache.drill.exec.compile.ClassTransformer.getImplementationClass():226
    org.apache.drill.exec.compile.CodeCompiler$CodeGenCompiler.compile():79
    org.apache.drill.exec.compile.CodeCompiler.makeClass():224
    org.apache.drill.exec.compile.CodeCompiler.access$300():41
    org.apache.drill.exec.compile.CodeCompiler$Loader.load():207
    org.apache.drill.exec.compile.CodeCompiler$Loader.load():204
    com.google.common.cache.LocalCache$LoadingValueReference.loadFuture():3527
    com.google.common.cache.LocalCache$Segment.loadSync():2319
    com.google.common.cache.LocalCache$Segment.lockedGetOrLoad():2282
    com.google.common.cache.LocalCache$Segment.get():2197
    com.google.common.cache.LocalCache.get():3937
    com.google.common.cache.LocalCache.getOrLoad():3941
    com.google.common.cache.LocalCache$LocalLoadingCache.get():4824
    org.apache.drill.exec.compile.CodeCompiler.createInstances():181
    org.apache.drill.exec.compile.CodeCompiler.createInstance():158
    org.apache.drill.exec.ops.FragmentContext.getImplementationClass():316
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.getGenerated2Copier():239
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.setupNewSchema():70
    org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():78
    org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext():93
    org.apache.drill.exec.record.AbstractRecordBatch.next():162
    org.apache.drill.exec.record.AbstractRecordBatch.next():119
    org.apache.drill.exec.record.AbstractRecordBatch.next():109
    org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
    org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():135
    org.apache.drill.exec.record.AbstractRecordBatch.next():162
    org.apache.drill.exec.physical.impl.BaseRootExec.next():104
    org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():81
    org.apache.drill.exec.physical.impl.BaseRootExec.next():94
    org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():232
    org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():226
    java.security.AccessController.doPrivileged():-2
    javax.security.auth.Subject.doAs():422
    org.apache.hadoop.security.UserGroupInformation.doAs():1595
    org.apache.drill.exec.work.fragment.FragmentExecutor.run():226
    org.apache.drill.common.SelfCleaningRunnable.run():38
    java.util.concurrent.ThreadPoolExecutor.runWorker():1142
    java.util.concurrent.ThreadPoolExecutor$Worker.run():617
    java.lang.Thread.run():745 (state=,code=0)

Env:

Drill 1.10

Root Cause:

Starting from Drill 1.10, above WARNING message is promoted to an ERROR message.
It means Drill must require JDK instead of JRE to run with.

Solution:

Make sure JDK is installed and Drill is using correct JAVA_HOME pointing to that JDK.
Below things need to be checked on a Linux env:

1. "java -version" should show correct JDK version.

# java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

2. "ps -ef|grep -i drillbit" should show correct java program is used by drillbit JVM process.

# ps -ef|grep -i drillbit |grep -v grep
mapr     14999     1  1 14:25 ?        00:01:21 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-0.b11.el6_9.x86_64/jre/bin/java -Xms1G -Xmx1G -XX:MaxDirectMemorySize=1G -XX:ReservedCodeCacheSize=1G -Ddrill.exec.enable-epoll=false -XX:MaxPermSize=512M -Djava.library.path=/opt/pam/ -Djava.security.auth.login.config=/opt/mapr/conf/mapr.login.conf -Dzookeeper.sasl.client=false -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC -Dlog.path=/opt/mapr/drill/drill-1.10.0/logs/drillbit.log -Dlog.query.path=/opt/mapr/drill/drill-1.10.0/logs/drillbit_queries.json -cp /opt/mapr/drill/drill-1.10.0/conf:/opt/mapr/drill/drill-1.10.0/jars/*:/opt/mapr/drill/drill-1.10.0/jars/ext/*:/opt/mapr/drill/drill-1.10.0/jars/3rdparty/*:/opt/mapr/drill/drill-1.10.0/jars/classb/* org.apache.drill.exec.server.Drillbit

3. "alternatives --config java" should show correct java program if the default java is used by drillbit.

# alternatives --config java

There are 4 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   3           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 4           /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number:

4. Last but not the least, "rpm -qa|grep -i java" should show required packages are installed.

# rpm -qa|grep -i java|grep -i 1.8
java-1.8.0-openjdk-1.8.0.131-0.b11.el6_9.x86_64
java-1.8.0-openjdk-headless-1.8.0.131-0.b11.el6_9.x86_64
java-1.8.0-openjdk-devel-1.8.0.131-0.b11.el6_9.x86_64
Note:  For openjdk, "java-<version>-openjdk-devel" package is a must!

No comments:

Post a Comment

Popular Posts