You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Guohua Hao <ha...@gmail.com> on 2009/12/15 07:58:26 UTC

running unit test based on HBaseClusterTestCase

Hello All,

In my own application, I have a unit test case which extends
HBaseClusterTestCase in order to test some of my operation over HBase
cluster. I override the setup function in my own test case, and this setup
function begins with super.setup() function call.

When I try to run my unit test from within Eclipse, I got the following
error:

java.lang.NoSuchMethodError:
org.apache.hadoop.security.UserGroupInformation.setCurrentUser(Lorg/apache/hadoop/security/UserGroupInformation;)V
    at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:236)
    at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:119)
    at
org.apache.hadoop.hbase.HBaseClusterTestCase.setUp(HBaseClusterTestCase.java:123)

I included the hadoop-0.20.1-core.jar in my classpath, since this jar file
contains the org.apache.hadoop.security.UserGroupInformation class.

Could anybody give me some hint on how to solve this problem?

Thank you very much,
Guohua

Re: running unit test based on HBaseClusterTestCase

Posted by stack <st...@duboce.net>.
Order can be important.  Don't forget to include conf directories.  Below is
from an eclipse .classpath that seems to work for me:

        <classpathentry kind="lib" path="conf"/>
        <classpathentry kind="src" path="src/test"/>
        <classpathentry kind="src" path="src/java"/>
        <classpathentry kind="lib" path="lib/jackson-core-asl-1.0.1.jar"/>
        <classpathentry kind="lib" path="build/lib/jetty-6.1.14.jar"/>
        <classpathentry kind="lib" path="lib/commons-cli-2.0-SNAPSHOT.jar"/>
        <classpathentry kind="lib"
path="lib/commons-el-from-jetty-5.1.4.jar"/>
        <classpathentry kind="lib" path="lib/commons-httpclient-3.0.1.jar"/>
        <classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
        <classpathentry kind="lib"
path="lib/commons-logging-api-1.0.4.jar"/>
        <classpathentry kind="lib" path="lib/commons-math-1.1.jar"/>
        <classpathentry kind="lib" path="lib/jasper-compiler-5.5.12.jar"/>
        <classpathentry kind="lib" path="lib/jasper-runtime-5.5.12.jar"/>
        <classpathentry kind="lib" path="lib/jetty-6.1.14.jar"/>
        <classpathentry kind="lib" path="lib/jetty-util-6.1.14.jar"/>
        <classpathentry kind="lib" path="lib/jruby-complete-1.3.1.jar"/>
        <classpathentry kind="lib" path="lib/json.jar"/>
        <classpathentry kind="lib" path="lib/jsp-2.1/jsp-2.1.jar"/>
        <classpathentry kind="lib" path="lib/jsp-2.1/jsp-api-2.1.jar"/>
        <classpathentry kind="lib" path="lib/junit-4.7.jar"/>
        <classpathentry kind="lib" path="lib/libthrift-r771587.jar"/>
        <classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
        <classpathentry kind="lib" path="lib/lucene-core-2.2.0.jar"/>
        <classpathentry kind="lib" path="lib/zookeeper-3.2.1.jar"/>
        <classpathentry kind="lib"
path="src/contrib/stargate/lib/asm-3.1.jar"/>
        <classpathentry kind="lib"
path="src/contrib/stargate/lib/commons-codec-1.3.jar"/>
        <classpathentry kind="lib"
path="src/contrib/stargate/lib/jaxb-impl-2.1.10.jar"/>
        <classpathentry kind="lib"
path="src/contrib/stargate/lib/jersey-core-1.1.0-ea.jar"/>
        <classpathentry kind="lib"
path="src/contrib/stargate/lib/jersey-json-1.1.0-ea.jar"/>
        <classpathentry kind="lib"
path="src/contrib/stargate/lib/jersey-server-1.1.0-ea.jar"/>
        <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="lib" path="lib/servlet-api-2.5-6.1.14.jar"/>
        <classpathentry kind="lib" path="build/hbase-0.21.0-dev.jar"/>
        <classpathentry kind="lib" path="lib/avro-1.2.0.jar"/>
        <classpathentry kind="lib" path="lib/jackson-mapper-asl-1.0.1.jar"/>
        <classpathentry kind="lib"
path="lib/hadoop-core-0.21.0-SNAPSHOT-r832250.jar"/>
        <classpathentry kind="lib"
path="lib/hadoop-core-test-0.21.0-SNAPSHOT-r832250.jar"/>
        <classpathentry kind="lib"
path="lib/hadoop-mapred-0.21.0-dev-r833993.jar"/>
        <classpathentry kind="lib"
path="lib/hadoop-mapred-test-0.21.0-dev-r833993.jar"/>
        <classpathentry kind="lib"
path="lib/hadoop-hdfs-0.21.0-dev-r836012.jar"/>
        <classpathentry kind="lib"
path="lib/hadoop-hdfs-test-0.21.0-dev-r836012.jar"/>
        <classpathentry kind="output" path="eclipse"/>

St.Ack


On Tue, Dec 15, 2009 at 11:21 AM, Guohua Hao <ha...@gmail.com> wrote:

> Yes, I included all the necessary jar files I think.  I guess my problem is
> probably related to my eclipse setup.
>
> I can create a MiniDFSCluster object by running my application in command
> line (e.g., bin/hadoop myApplicationClass) , and a MiniDFSCluster object is
> created inside the main function of myApplicationClass. But I can NOT run
> this program within eclipse, probably I did not do it in the right way. I
> got the similar error message saying
>
> java.lang.NoSuchMethodError:
> org.apache.hadoop.security.
> >
> >
> >
> UserGroupInformation.setCurrentUser(Lorg/apache/hadoop/security/UserGroupInformation;)V
> >   at
> org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:236)
> >   at
> org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:119)
> >
>
>  Could you guys please give me more hint?
>
> Thanks
> Guohua
>
>
>
> On Tue, Dec 15, 2009 at 11:59 AM, Stack <sa...@gmail.com> wrote:
>
> > Do you have hadoop jars in your eclipse classpath?
> > Stack
> >
> >
> >
> >
> > On Dec 14, 2009, at 10:58 PM, Guohua Hao <ha...@gmail.com> wrote:
> >
> >  Hello All,
> >>
> >> In my own application, I have a unit test case which extends
> >> HBaseClusterTestCase in order to test some of my operation over HBase
> >> cluster. I override the setup function in my own test case, and this
> setup
> >> function begins with super.setup() function call.
> >>
> >> When I try to run my unit test from within Eclipse, I got the following
> >> error:
> >>
> >> java.lang.NoSuchMethodError:
> >>
> >>
> org.apache.hadoop.security.UserGroupInformation.setCurrentUser(Lorg/apache/hadoop/security/UserGroupInformation;)V
> >>   at
> org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:236)
> >>   at
> org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:119)
> >>   at
> >>
> >>
> org.apache.hadoop.hbase.HBaseClusterTestCase.setUp(HBaseClusterTestCase.java:123)
> >>
> >> I included the hadoop-0.20.1-core.jar in my classpath, since this jar
> file
> >> contains the org.apache.hadoop.security.UserGroupInformation class.
> >>
> >> Could anybody give me some hint on how to solve this problem?
> >>
> >> Thank you very much,
> >> Guohua
> >>
> >
>

Re: running unit test based on HBaseClusterTestCase

Posted by Guohua Hao <ha...@gmail.com>.
Yes, I included all the necessary jar files I think.  I guess my problem is
probably related to my eclipse setup.

I can create a MiniDFSCluster object by running my application in command
line (e.g., bin/hadoop myApplicationClass) , and a MiniDFSCluster object is
created inside the main function of myApplicationClass. But I can NOT run
this program within eclipse, probably I did not do it in the right way. I
got the similar error message saying

java.lang.NoSuchMethodError:
org.apache.hadoop.security.
>
>
> UserGroupInformation.setCurrentUser(Lorg/apache/hadoop/security/UserGroupInformation;)V
>   at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:236)
>   at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:119)
>

 Could you guys please give me more hint?

Thanks
Guohua



On Tue, Dec 15, 2009 at 11:59 AM, Stack <sa...@gmail.com> wrote:

> Do you have hadoop jars in your eclipse classpath?
> Stack
>
>
>
>
> On Dec 14, 2009, at 10:58 PM, Guohua Hao <ha...@gmail.com> wrote:
>
>  Hello All,
>>
>> In my own application, I have a unit test case which extends
>> HBaseClusterTestCase in order to test some of my operation over HBase
>> cluster. I override the setup function in my own test case, and this setup
>> function begins with super.setup() function call.
>>
>> When I try to run my unit test from within Eclipse, I got the following
>> error:
>>
>> java.lang.NoSuchMethodError:
>>
>> org.apache.hadoop.security.UserGroupInformation.setCurrentUser(Lorg/apache/hadoop/security/UserGroupInformation;)V
>>   at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:236)
>>   at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:119)
>>   at
>>
>> org.apache.hadoop.hbase.HBaseClusterTestCase.setUp(HBaseClusterTestCase.java:123)
>>
>> I included the hadoop-0.20.1-core.jar in my classpath, since this jar file
>> contains the org.apache.hadoop.security.UserGroupInformation class.
>>
>> Could anybody give me some hint on how to solve this problem?
>>
>> Thank you very much,
>> Guohua
>>
>

Re: running unit test based on HBaseClusterTestCase

Posted by Stack <sa...@gmail.com>.
Do you have hadoop jars in your eclipse classpath?
Stack



On Dec 14, 2009, at 10:58 PM, Guohua Hao <ha...@gmail.com> wrote:

> Hello All,
>
> In my own application, I have a unit test case which extends
> HBaseClusterTestCase in order to test some of my operation over HBase
> cluster. I override the setup function in my own test case, and this  
> setup
> function begins with super.setup() function call.
>
> When I try to run my unit test from within Eclipse, I got the  
> following
> error:
>
> java.lang.NoSuchMethodError:
> org.apache.hadoop.security.UserGroupInformation.setCurrentUser(Lorg/ 
> apache/hadoop/security/UserGroupInformation;)V
>    at org.apache.hadoop.hdfs.MiniDFSCluster.<init> 
> (MiniDFSCluster.java:236)
>    at org.apache.hadoop.hdfs.MiniDFSCluster.<init> 
> (MiniDFSCluster.java:119)
>    at
> org.apache.hadoop.hbase.HBaseClusterTestCase.setUp 
> (HBaseClusterTestCase.java:123)
>
> I included the hadoop-0.20.1-core.jar in my classpath, since this  
> jar file
> contains the org.apache.hadoop.security.UserGroupInformation class.
>
> Could anybody give me some hint on how to solve this problem?
>
> Thank you very much,
> Guohua