[
https://issues.apache.org/jira/browse/DRILL-6349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16683567#comment-16683567
]
ASF GitHub Bot commented on DRILL-6349:
---------------------------------------
vvysotskyi commented on a change in pull request #1446: DRILL-6349: Drill JDBC
driver fails on Java 1.9+ with NoClassDefFoundError: sun/misc/VM
URL: https://github.com/apache/drill/pull/1446#discussion_r232586065
##########
File path: distribution/src/resources/sqlline.bat
##########
@@ -1,226 +1,234 @@
-@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing, software
-@REM distributed under the License is distributed on an "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@REM See the License for the specific language governing permissions and
-@REM limitations under the License.
-@REM
-
-@echo off
-@rem/*
-@rem * Licensed to the Apache Software Foundation (ASF) under one
-@rem * or more contributor license agreements. See the NOTICE file
-@rem * distributed with this work for additional information
-@rem * regarding copyright ownership. The ASF licenses this file
-@rem * to you under the Apache License, Version 2.0 (the
-@rem * "License"); you may not use this file except in compliance
-@rem * with the License. You may obtain a copy of the License at
-@rem *
-@rem * http://www.apache.org/licenses/LICENSE-2.0
-@rem *
-@rem * Unless required by applicable law or agreed to in writing, software
-@rem * distributed under the License is distributed on an "AS IS" BASIS,
-@rem * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem * See the License for the specific language governing permissions and
-@rem * limitations under the License.
-@rem */
-@rem
-setlocal EnableExtensions EnableDelayedExpansion
-
-rem ----
-rem In order to pass in arguments with an equals symbol, use quotation marks.
-rem For example
-rem sqlline -u "jdbc:drill:zk=local" -n admin -p admin
-rem ----
-
-rem ----
-rem Deal with command-line arguments
-rem ----
-
-:argactionstart
-if -%1-==-- goto argactionend
-
-set atleastonearg=0
-
-if x%1 == x-q (
- set QUERY=%2
- set atleastonearg=1
- shift
- shift
-)
-
-if x%1 == x-e (
- set QUERY=%2
- set atleastonearg=1
- shift
- shift
-)
-
-if x%1 == x-f (
- set FILE=%2
- set atleastonearg=1
- shift
- shift
-)
-
-if x%1 == x--config (
- set confdir=%2
- set DRILL_CONF_DIR=%2
- set atleastonearg=1
- shift
- shift
-)
-
-if x%1 == x--jvm (
- set DRILL_SHELL_JAVA_OPTS=!DRILL_SHELL_JAVA_OPTS! %2
- set DRILL_SHELL_JAVA_OPTS=!DRILL_SHELL_JAVA_OPTS:"=!
- set atleastonearg=1
- shift
- shift
-)
-
-if "!atleastonearg!"=="0" (
- set DRILL_ARGS=!DRILL_ARGS! %~1
- shift
-)
-
-goto argactionstart
-:argactionend
-
-rem ----
-rem Validate JAVA_HOME
-rem ----
-if "%JAVA_EXE%" == "" (set JAVA_EXE=java.exe)
-
-if not "%JAVA_HOME%" == "" goto javaHomeSet
-echo.
-echo WARN: JAVA_HOME not found in your environment.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation
-echo.
-goto initDrillEnv
-
-:javaHomeSet
-if exist "%JAVA_HOME%\bin\%JAVA_EXE%" goto initDrillEnv
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory.
-echo JAVA_HOME = %JAVA_HOME%
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation
-echo.
-goto error
-
-:initDrillEnv
-echo DRILL_ARGS - "%DRILL_ARGS%"
-
-rem ----
-rem Deal with Drill variables
-rem ----
-
-set DRILL_BIN_DIR=%~dp0
-pushd %DRILL_BIN_DIR%..
-set DRILL_HOME=%cd%
-popd
-
-if "test%DRILL_CONF_DIR%" == "test" (
- set DRILL_CONF_DIR=%DRILL_HOME%\conf
-)
-
-if "test%DRILL_LOG_DIR%" == "test" (
- set DRILL_LOG_DIR=%DRILL_HOME%\log
-)
-
-@rem Drill temporary directory is used as base for temporary storage of
Dynamic UDF jars.
-if "test%DRILL_TMP_DIR%" == "test" (
- set DRILL_TMP_DIR=%TEMP%
-)
-
-rem ----
-rem Deal with Hadoop JARs, if HADOOP_HOME was specified
-rem ----
-
-if "test%HADOOP_HOME%" == "test" (
- echo HADOOP_HOME not detected...
- set USE_HADOOP_CP=0
- set HADOOP_HOME=%DRILL_HOME%\winutils
-) else (
- echo Calculating HADOOP_CLASSPATH ...
- for %%i in (%HADOOP_HOME%\lib\*.jar) do (
- set IGNOREJAR=0
- for /F "tokens=*" %%A in (%DRILL_BIN_DIR%\hadoop-excludes.txt) do (
- echo.%%~ni|findstr /C:"%%A" >nul 2>&1
- if not errorlevel 1 set IGNOREJAR=1
- )
- if "!IGNOREJAR!"=="0" set HADOOP_CLASSPATH=%%i;!HADOOP_CLASSPATH!
- )
- set HADOOP_CLASSPATH=%HADOOP_HOME%\conf;!HADOOP_CLASSPATH!
- set USE_HADOOP_CP=1
-)
-
-rem ----
-rem Deal with HBase JARs, if HBASE_HOME was specified
-rem ----
-
-if "test%HBASE_HOME%" == "test" (
- echo HBASE_HOME not detected...
- set USE_HBASE_CP=0
-) else (
- echo Calculating HBASE_CLASSPATH ...
- for %%i in (%HBASE_HOME%\lib\*.jar) do (
- set IGNOREJAR=0
- for /F "tokens=*" %%A in (%DRILL_BIN_DIR%\hadoop-excludes.txt) do (
- echo.%%~ni|findstr /C:"%%A" >nul 2>&1
- if not errorlevel 1 set IGNOREJAR=1
- )
- if "!IGNOREJAR!"=="0" set HBASE_CLASSPATH=%%i;!HBASE_CLASSPATH!
- )
- set HBASE_CLASSPATH=%HADOOP_HOME%\conf;!HBASE_CLASSPATH!
- set USE_HBASE_CP=1
-)
-
-echo Calculating Drill classpath...
-
-set DRILL_CP=%DRILL_CONF_DIR%
-if NOT "test%DRILL_CLASSPATH_PREFIX%"=="test" set
DRILL_CP=!DRILL_CP!;%DRILL_CLASSPATH_PREFIX%
-set DRILL_CP=%DRILL_CP%;%DRILL_HOME%\jars\*
-set DRILL_CP=%DRILL_CP%;%DRILL_HOME%\jars\ext\*
-if "test%USE_HADOOP_CP%"=="test1" set DRILL_CP=!DRILL_CP!;%HADOOP_CLASSPATH%
-if "test%USE_HBASE_CP%"=="test1" set DRILL_CP=!DRILL_CP!;%HBASE_CLASSPATH%
-set DRILL_CP=%DRILL_CP%;%DRILL_HOME%\jars\3rdparty\*
-set DRILL_CP=%DRILL_CP%;%DRILL_HOME%\jars\classb\*
-if NOT "test%DRILL_CLASSPATH%"=="test" set
DRILL_CP=!DRILL_CP!;%DRILL_CLASSPATH%
-
-set DRILL_SHELL_JAVA_OPTS=%DRILL_SHELL_JAVA_OPTS%
-Dlog.path="%DRILL_LOG_DIR%\sqlline.log"
-Dlog.query.path="%DRILL_LOG_DIR%\sqlline_queries.log"
-
-SET JAVA_CMD=%JAVA_HOME%\bin\%JAVA_EXE%
-if "%JAVA_HOME%" == "" (set JAVA_CMD=%JAVA_EXE%)
-set ERROR_CODE=0
-set SQLLINE_CALL=sqlline.SqlLine -ac
org.apache.drill.exec.client.DrillSqlLineApplication -d
org.apache.drill.jdbc.Driver
-if NOT "test%QUERY%"=="test" (
- echo %QUERY% | "%JAVA_CMD%" %DRILL_SHELL_JAVA_OPTS% %DRILL_JAVA_OPTS% -cp
"%DRILL_CP%" %SQLLINE_CALL% %DRILL_ARGS%
-) else (
- if NOT "test%FILE%"=="test" (
- "%JAVA_CMD%" %DRILL_SHELL_JAVA_OPTS% %DRILL_JAVA_OPTS% -cp "%DRILL_CP%"
%SQLLINE_CALL% %DRILL_ARGS% --run=%FILE%
- ) else (
- "%JAVA_CMD%" %DRILL_SHELL_JAVA_OPTS% %DRILL_JAVA_OPTS% -cp "%DRILL_CP%"
%SQLLINE_CALL% %DRILL_ARGS%
- )
-)
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-endlocal
-exit /B %ERROR_CODE%
+@REM
Review comment:
Please revert changes here connected with replacing `CRLF` by `LF`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Drill JDBC driver fails on Java 1.9+ with NoClassDefFoundError: sun/misc/VM
> ---------------------------------------------------------------------------
>
> Key: DRILL-6349
> URL: https://issues.apache.org/jira/browse/DRILL-6349
> Project: Apache Drill
> Issue Type: Bug
> Components: Client - JDBC
> Affects Versions: 1.13.0
> Environment: 16:23 apache-drill-1.13.0$ uname -a
> Darwin bix.local 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST
> 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64
>
> Reporter: Marc Prud'hommeaux
> Assignee: Oleg Zinoviev
> Priority: Major
> Fix For: 1.15.0
>
>
> I'm surprised to be unable to find this issue logged elsewhere, but a quick
> search yields nothing. Trying to connect with the JDBC driver raises a
> NoClassDefFoundError for sun.misc.VM, which was removed in Java 9. It is
> understandable that the full drillbit (or its many dependencies) may have
> difficult-to-extract dependencies on some sun.misc.* classes, but the JDBC
> driver should be able to be loaded by any JVM.
>
> Looking at
> ./common/src/main/java/org/apache/drill/common/config/DrillConfig.java, it
> appears that a quick workaround could be to make sun.misc.VM.maxDirectMemory
> called lazily from the one place that uses it: getMaxDirectMemory()
>
>
>
> {{}}{{16:21 apache-drill-1.13.0$
> JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk
> ./bin/drill-localhost }}
> ***Connecting to jdbc:drill:drillbit=localhost*
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by
> org.apache.calcite.avatica.com.google.protobuf.UnsafeUtil
> (file:/Users/marc/Downloads/apache-drill-1.13.0/jars/3rdparty/avatica-1.10.0.jar)
> to field java.nio.Buffer.address
> WARNING: Please consider reporting this to the maintainers of
> org.apache.calcite.avatica.com.google.protobuf.UnsafeUtil
> WARNING: Use --illegal-access=warn to enable warnings of further illegal
> reflective access operations
> WARNING: All illegal access operations will be denied in a future release
> {{java.lang.NoClassDefFoundError: sun/misc/VM}}
> {{ at
> org.apache.drill.common.config.DrillConfig.<clinit>(DrillConfig.java:49)}}
> {{ at
> org.apache.drill.jdbc.impl.DrillConnectionImpl.<init>(DrillConnectionImpl.java:155)}}
> {{ at
> org.apache.drill.jdbc.impl.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:73)}}
> {{ at
> org.apache.drill.jdbc.impl.DrillFactory.newConnection(DrillFactory.java:69)}}
> {{ at
> org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:138)}}
> {{ at org.apache.drill.jdbc.Driver.connect(Driver.java:72)}}
> {{ at sqlline.DatabaseConnection.connect(DatabaseConnection.java:168)}}
> {{ at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:214)}}
> {{ at sqlline.Commands.connect(Commands.java:1083)}}
> {{ at sqlline.Commands.connect(Commands.java:1015)}}
> {{ at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)}}
> {{ at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)}}
> {{ at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)}}
> {{ at java.base/java.lang.reflect.Method.invoke(Method.java:564)}}
> {{ at
> sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)}}
> {{ at sqlline.SqlLine.dispatch(SqlLine.java:742)}}
> {{ at sqlline.SqlLine.initArgs(SqlLine.java:528)}}
> {{ at sqlline.SqlLine.begin(SqlLine.java:596)}}
> {{ at sqlline.SqlLine.start(SqlLine.java:375)}}
> {{ at sqlline.SqlLine.main(SqlLine.java:268)}}
> {{Caused by: java.lang.ClassNotFoundException: sun.misc.VM}}
> {{ at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)}}
> {{ at
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)}}
> {{ at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)}}
> {{... 20 more}}
> apache drill 1.13.0
> "just drill it"
> 0: jdbc:drill:drillbit=localhost>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)