0

I installed hive and hadoop in windows as per the link. I can able to create tables and load data in hive but when I tried to start the hiveserver2 using command

hive --service hiveserver2

Facing the below exception. Metastore is also up and running

My hive version - 3.1.2 Hdfs version - 3.3.2 java - 1.8

Commands I used in admin mode 1st (Starting hdfs) -> start-all.cmd 2nd (starting metastore) -> hive --service metastore (From $hive_home/bin dir) 3rd (starting hiveserver2) -> hive --service hiveServer2 (From $hive_home/bin dir)

ERROR

C:\apache-hive-3.1.2-bin\bin>hive --service hiveserver2
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/hadoop-3.3.2/share/hadoop/common/lib/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.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.slf4j.impl.Log4jLoggerFactory]
2023-06-13 12:16:01,063 INFO conf.HiveConf: Found configuration file file:/C:/apache-hive-3.1.2-bin/conf/hive-site.xml
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hive/org/apache/commons/cli/ParseException
        at org.apache.hive.service.server.HiveServer2.main(HiveServer2.java:1136)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:323)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:236)
Caused by: java.lang.ClassNotFoundException: org.apache.hive.org.apache.commons.cli.ParseException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 7 more

I have also checked the directories C:\apache-hive-3.1.2-bin\lib, for the jar file commons-cli-1.2.jar it is there.. but I still facing above exception.

Currently I'm trying to connect to hive using java app(play framework), so I need hiveserver2 running.

  • I would probably add `echo ${CLASSPATH}` before this line https://github.com/apache/hive/blob/rel/release-3.1.2/bin/hive#L360 and examine the classpath – Sercan Jun 13 '23 at 18:12
  • 1
    @Sercan That wont work for Windows, but yes, `hive classpath` should be shown – OneCricketeer Jun 13 '23 at 20:38
  • I tried printing HiveClasspath -> ';C:\apache-hive-3.1.2-bin\conf;C:\apache-hive-3.1.2-bin\lib\*;' anything could you suggest from this guys @Sercan – Dinesh Babu M Jun 15 '23 at 10:29
  • This uri `org/apache/hive/org/apache/commons/cli/ParseException` looks like some shaded version from inside one of hive jars, not simply a reference to plain commons-cli.x.x.jar. Where did you get your Hive jars from? – mazaneicha Jun 21 '23 at 20:27

0 Answers0