Wednesday, December 19, 2012

Exception in thread "main" java.lang.NoSuchFieldError: type at org.apache.hadoop.hive.ql.parse.HiveLexer.mKW_CREATE(

Now you have successfully configured Hadoop and everything is running perfectly fine. So, you decided to give Hive a try. But, soon as you try to create the very first table you find yourself into something like this :

Exception in thread "main" java.lang.NoSuchFieldError: type
        at org.apache.hadoop.hive.ql.parse.HiveLexer.mKW_CREATE(
        at org.apache.hadoop.hive.ql.parse.HiveLexer.mTokens(
        at org.antlr.runtime.Lexer.nextToken(
        at org.antlr.runtime.BufferedTokenStream.fetch(
        at org.antlr.runtime.BufferedTokenStream.sync(
        at org.antlr.runtime.CommonTokenStream.setup(
        at org.antlr.runtime.CommonTokenStream.LT(
        at org.apache.hadoop.hive.ql.parse.HiveParser.statement(
        at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(
        at org.apache.hadoop.hive.ql.Driver.compile(
        at org.apache.hadoop.hive.ql.Driver.compile(
        at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(
        at org.apache.hadoop.hive.cli.CliDriver.processCmd(
        at org.apache.hadoop.hive.cli.CliDriver.processLine(
        at org.apache.hadoop.hive.cli.CliDriver.main(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.apache.hadoop.util.RunJar.main(

Need not worry. It's something related to antlr-*.jar which is present inside you HIVE_HOME/lib directory. Just make sure you don't have any other antlr-*.jar in your classpath. If it still doesn't work, download the latest version from the ANTLR website and put it inside your HIVE_HOME/lib. Restart Hive and you are good to go...

NOTE: If you want to see how to configure Hadoop you can go here

No comments:

Post a Comment

How to work with Avro data using Apache Spark(Spark SQL API)

We all know how cool Spark is when it comes to fast, general-purpose cluster computing. Apart from the core APIs Spark also provides a rich ...