Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Unable to start Hive 3 with java 11 #59

Closed
Sarrouna opened this issue Feb 2, 2021 · 10 comments
Closed

Unable to start Hive 3 with java 11 #59

Sarrouna opened this issue Feb 2, 2021 · 10 comments
Labels
question User question

Comments

@Sarrouna
Copy link

Sarrouna commented Feb 2, 2021

I installed Apache Hive 3 and Apache hadoop 3 in my system that contain Java 11. I initialized the database and launched the metastore successfully on port[9083]

I had some exceptions that blocked the start of the metastore but I resolved them. When I start hive CLI I git the following exception:

# ./hive 
which: no hbase in (/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) 
SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/root/hive/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/root/hive/hadoop-3.1.4/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] 
Hive Session ID = be63992b-0558-427d-9a77-ca3506168c15 
Exception in thread "main" java.lang.ClassCastException: jdk.internal.loader.ClassLoaders$AppClassLoader incompatible with java.net.URLClassLoader 
 at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:413) 
 at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:389) 
 at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:60) 
 at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705) 
 at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:683) 
 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:566) 
 at org.apache.hadoop.util.RunJar.run(RunJar.java:318) 
 at org.apache.hadoop.util.RunJar.main(RunJar.java:232) 

I had a look in the forums and as my understanding that Hive 3 not support java 11. But, I didn't find a confirmed information from Hive.

Please someone have an information about the exception above how to resolve it in Hive 3 with java 11 ?
@morazow I saw that you post the same issue in 2019, do you have please an idea about this issue because I'm facing it in 2021 :) Do you know please if Hadoop and Hive dependencies are still using Java 8 ?
Thanks in advance.

@morazow
Copy link
Contributor

morazow commented Feb 2, 2021

Hello @Sarrouna,

Could you please tell where the Hive runs, is it inside the Exasol database? Do you also get the issue when trying to import data from Hive into Exasol database?

Please try to use the latest version of the connector. It maybe related to the #56.

@morazow morazow added the question User question label Feb 2, 2021
@Sarrouna
Copy link
Author

Sarrouna commented Feb 2, 2021

Hi @morazow
Thanks for your answer. In fact, I'm not using Exasol database. I'm using Mysql. Hive is running in a Sandbox for testing.
I installed inside Apache Hive 3 + Apache hadoop 3 (because Hive need some jar files from Hadoop) and I have Java 11 is installed.
I changed the property in hive-site.xml

<property> 
 <name>hive.metastore.uri.selection</name> 
 <value>SEQUENTIAL</value> 
 <description> 
 Expects one of [sequential, random]. 
 Determines the selection mechanism used by metastore client to connect to remote metastore. SEQUENTIAL implies that the first valid metastore from the URIs specified as part of hive.metastore.uris will be picked. RANDOM implies that the metastore will be picked randomly 
 </description> 
 </property>

then I restarted the metastore. But the Hive CLI still return the same exception that mentioned above.

@morazow
Copy link
Contributor

morazow commented Feb 3, 2021

Hello @Sarrouna,

If it is your own sandbox, you can easily change the Java versions. I think Apache Hive still uses Java 8.

Please check first if the other java versions are installed:

sudo update-alternatives --config java

Otherwise, you can install java 8 with following commands on linux systems:

sudo apt install openjdk-8-jdk

And then use the above update-alternatives command to change to the Java 8 system wide.

The issue is usually occurs when Hive libraries that are compiled with Java 8 run in Java 9+ environments. It is no longer possible to cast the ClassLoader to URLClassLoader, it is one of the breaking changes from Java 8 to Java 9+.

@Sarrouna
Copy link
Author

Sarrouna commented Feb 3, 2021

Hi @morazow

Thanks for helping. In fact, yes I was thinking on that but, first we don't have a right to change between java versions, and second, I project to use Hive 3 with Trino (it's a fork of Prestodb). And Trino recommand to use Java 11+. It's don't support earlier java 11 versions.
Do you have a link from a confident source that confirm Hive 3 don't support java 11 ?
Thanks a lot

@morazow
Copy link
Contributor

morazow commented Feb 3, 2021

Hey @Sarrouna,

That is too bad.

Yes. I checked the source files. I think you are using Hive 3.1 version. Here on the pom file on the 3.1 branch it is still build with Java 8.

The error you are seeing can also be found on the source files:
https://github.com/apache/hive/blob/branch-3.1/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java#L413

That line expected to fail on the Java 9+ versions.

@Sarrouna
Copy link
Author

Sarrouna commented Feb 3, 2021

That's great. It mentioned clearly that Hive 3 still using java 8. Thanks a lot @morazow for your answers.

@morazow
Copy link
Contributor

morazow commented Feb 3, 2021

Hey @Sarrouna,

Thanks for the feedback! Would it be okay to close this ticket?

All the best

@Sarrouna Sarrouna closed this as completed Feb 3, 2021
@willzhang
Copy link

so many problems install hive

@shrinath0113
Copy link

I installed Apache Hive 3 and Apache hadoop 3 in my system that contain Java 11. I initialized the database and launched the metastore successfully on port[9083]

I had some exceptions that blocked the start of the metastore but I resolved them. When I start hive CLI I git the following exception:

# ./hive 
which: no hbase in (/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) 
SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/root/hive/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/root/hive/hadoop-3.1.4/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] 
Hive Session ID = be63992b-0558-427d-9a77-ca3506168c15 
Exception in thread "main" java.lang.ClassCastException: jdk.internal.loader.ClassLoaders$AppClassLoader incompatible with java.net.URLClassLoader 
 at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:413) 
 at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:389) 
 at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:60) 
 at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705) 
 at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:683) 
 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:566) 
 at org.apache.hadoop.util.RunJar.run(RunJar.java:318) 
 at org.apache.hadoop.util.RunJar.main(RunJar.java:232) 

I had a look in the forums and as my understanding that Hive 3 not support java 11. But, I didn't find a confirmed information from Hive.

Please someone have an information about the exception above how to resolve it in Hive 3 with java 11 ? @morazow I saw that you post the same issue in 2019, do you have please an idea about this issue because I'm facing it in 2021 :) Do you know please if Hadoop and Hive dependencies are still using Java 8 ? Thanks in advance.

How to resolve this?

@shrinath0113
Copy link

I installed Apache Hive 3 and Apache hadoop 3 in my system that contain Java 11. I initialized the database and launched the metastore successfully on port[9083]

I had some exceptions that blocked the start of the metastore but I resolved them. When I start hive CLI I git the following exception:

# ./hive 
which: no hbase in (/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) 
SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/root/hive/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/root/hive/hadoop-3.1.4/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] 
Hive Session ID = be63992b-0558-427d-9a77-ca3506168c15 
Exception in thread "main" java.lang.ClassCastException: jdk.internal.loader.ClassLoaders$AppClassLoader incompatible with java.net.URLClassLoader 
 at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:413) 
 at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:389) 
 at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:60) 
 at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705) 
 at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:683) 
 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:566) 
 at org.apache.hadoop.util.RunJar.run(RunJar.java:318) 
 at org.apache.hadoop.util.RunJar.main(RunJar.java:232) 

I had a look in the forums and as my understanding that Hive 3 not support java 11. But, I didn't find a confirmed information from Hive.

Please someone have an information about the exception above how to resolve it in Hive 3 with java 11 ? @morazow I saw that you post the same issue in 2019, do you have please an idea about this issue because I'm facing it in 2021 :) Do you know please if Hadoop and Hive dependencies are still using Java 8 ? Thanks in advance.

You mean that uninstall java version 11 and install 8 in simple!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question User question
Projects
None yet
Development

No branches or pull requests

4 participants