You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Thejas Nair <th...@hortonworks.com> on 2012/06/01 04:42:06 UTC

Re: Issue with PigServer: java.lang.NoSuchFieldError: name

Do you have another version of antlr jar in your classpath (different 
from version used in pig)? I have seen this problem earlier, and it 
seemed to go away when I removed unnecessary jars from classpath 
(including antlr).

Thanks,
Thejas
On 5/31/12 7:35 AM, Etienne Dumoulin wrote:
> Hi all,
>
> I try to use pigserver for the first time, I have an exception
> and I did not find much about it on the official website and google.
>
> I have a problem to launch a query from a Java program.
> The query is tested and works in command line mode.
>
>
> The java code:
>
> try {
>              if(distributed){
>                  pig = new PigServer(ExecType.MAPREDUCE);
>              }else{
>                  pig = new PigServer(ExecType.LOCAL);
>              }
>              logger.debug("Pig query to launch: \n"+query);
>              pig.registerQuery(query);
>              logger.debug("Store process...");
>              pig.store("A",
> "hbase://"+tableNameTo,"org.apache.pig.backend.hadoop.hbase.HBaseStorage('"+hbaseFeat+"')");
>
>          } catch (ExecException e) {....
>
> The logs when tested in local mode:
> .
> .
> [May 31 15:15:04] DEBUG (HBaseStatement.java:407) - Pig query to launch:
> A = LOAD '/tmp/hbase/test' USING PigStorage('|');
> Exception in thread "main" java.lang.NoSuchFieldError: name
>          at
> org.apache.pig.parser.QueryParserStringStream.<init>(QueryParserStringStream.java:32)
>          at
> org.apache.pig.parser.QueryParserDriver.tokenize(QueryParserDriver.java:198)
>          at
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:166)
>          at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1589)
>          at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1540)
>          at org.apache.pig.PigServer.registerQuery(PigServer.java:540)
>          at org.apache.pig.PigServer.registerQuery(PigServer.java:553)
> .
> .
>
> Thanks,
>
> Étienne
>


Re: Issue with PigServer: java.lang.NoSuchFieldError: name

Posted by Etienne Dumoulin <et...@idiro.com>.
Hi Thejas,

Thank you very much. It was exactly that. You spare me hours of headache.
I insert all the jars of hadoop, hive, hbase and pig in my classpath. In
hive 0.80, there
is :
ant-contrib-1.0b3.jar
antlr-2.7.7.jar
antlr-3.0.1.jar
antlr-runtime-3.0.1.jar
I just removed all of them. It works also if you remove only the 'antlr*'.

Thanks again,

Étienne

On 1 June 2012 03:42, Thejas Nair <th...@hortonworks.com> wrote:

> Do you have another version of antlr jar in your classpath (different from
> version used in pig)? I have seen this problem earlier, and it seemed to go
> away when I removed unnecessary jars from classpath (including antlr).
>
> Thanks,
> Thejas
>
> On 5/31/12 7:35 AM, Etienne Dumoulin wrote:
>
>> Hi all,
>>
>> I try to use pigserver for the first time, I have an exception
>> and I did not find much about it on the official website and google.
>>
>> I have a problem to launch a query from a Java program.
>> The query is tested and works in command line mode.
>>
>>
>> The java code:
>>
>> try {
>>             if(distributed){
>>                 pig = new PigServer(ExecType.MAPREDUCE);
>>             }else{
>>                 pig = new PigServer(ExecType.LOCAL);
>>             }
>>             logger.debug("Pig query to launch: \n"+query);
>>             pig.registerQuery(query);
>>             logger.debug("Store process...");
>>             pig.store("A",
>> "hbase://"+tableNameTo,"org.**apache.pig.backend.hadoop.**
>> hbase.HBaseStorage('"+**hbaseFeat+"')");
>>
>>         } catch (ExecException e) {....
>>
>> The logs when tested in local mode:
>> .
>> .
>> [May 31 15:15:04] DEBUG (HBaseStatement.java:407) - Pig query to launch:
>> A = LOAD '/tmp/hbase/test' USING PigStorage('|');
>> Exception in thread "main" java.lang.NoSuchFieldError: name
>>         at
>> org.apache.pig.parser.**QueryParserStringStream.<init>**
>> (QueryParserStringStream.java:**32)
>>         at
>> org.apache.pig.parser.**QueryParserDriver.tokenize(**
>> QueryParserDriver.java:198)
>>         at
>> org.apache.pig.parser.**QueryParserDriver.parse(**
>> QueryParserDriver.java:166)
>>         at org.apache.pig.PigServer$**Graph.parseQuery(PigServer.**
>> java:1589)
>>         at org.apache.pig.PigServer$**Graph.registerQuery(PigServer.**
>> java:1540)
>>         at org.apache.pig.PigServer.**registerQuery(PigServer.java:**540)
>>         at org.apache.pig.PigServer.**registerQuery(PigServer.java:**553)
>> .
>> .
>>
>> Thanks,
>>
>> Étienne
>>
>>
>