You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Jean-Marc Spaggiari <je...@spaggiari.org> on 2013/01/30 13:54:07 UTC

org.apache.hadoop.hbase.coprocessor.TestClassLoading failing in Eclipse, not in shell...

Hi,

JUnit tests are failing in Eclipse for TestClassLoading but are
working fine with mvn command line.

Does anyone know why and how to fix that?

JM

Re: org.apache.hadoop.hbase.coprocessor.TestClassLoading failing in Eclipse, not in shell...

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Hi Adrian,

Yes, I tried it with a pure JUnit test in eclipse.

I have submitted https://issues.apache.org/jira/browse/HBASE-7718 for
this issue. I tried it into Eclipse and with mvn command line and both
are working fine.

JM

2013/1/30, Adrian Muraru <am...@adobe.com>:
> Hi JM,
>
> You are running the test as a pure Junit test in eclipse right?
> This is expected given the assumption that the test is run through
> surefire plugin:
> https://github.com/apache/hbase/blob/0.94/src/test/java/org/apache/hadoop/h
> base/coprocessor/TestClassLoading.java#L171
>
>
> Additional class path tweaking is needed there to make it working from
> eclipse.
>
> /adrian
>
>
> On 1/30/13 4:03 PM, "Jean-Marc Spaggiari" <je...@spaggiari.org> wrote:
>
>>Hi Ted,
>>
>>You have a point for the JVM!
>>
>>MVN is running with: Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre
>>And Eclikpse with /usr/local/jdk1.7.0_05/
>>
>>I change alligned the 2 to point to 1.7 but I'm still getting the same
>>results.
>>
>>
> >From mvn:
>>Running org.apache.hadoop.hbase.coprocessor.TestClassLoading
>>Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 40.215 sec
>>
>>
>>
> >From the eclipse console, for TestClassLoading.testHBase3810 I can see
>>this:
>>
>>2013-01-30 08:46:04,962 DEBUG [main]
>>coprocessor.TestClassLoading(178): Setting classpath to:
>>/home/jmspaggi/workspace/hbase/hbase-server/./target/classes:null
>>/home/jmspaggi/workspace/hbase/hbase-server/target/test-data/62cedbf2-dfb4
>>-4d6c-af05-bd9af0e46c77/src/TestCP1.java:1:
>>cannot access com.google.common.collect.ImmutableList
>>class file for com.google.common.collect.ImmutableList not found
>>import org.apache.hadoop.hbase.coprocessor.*;public class TestCP1
>>extends BaseRegionObserver {}
>>
> >From the eclipse console, for
>>TestClassLoading.testClassLoadingFromLibDirInJar I can see this:
>>2013-01-30 08:57:24,838 DEBUG [main]
>>coprocessor.TestClassLoading(178): Setting classpath to:
>>/home/jmspaggi/workspace/hbase/hbase-server/./target/classes:null
>>/home/jmspaggi/workspace/hbase/hbase-server/target/test-data/4585d7e8-a341
>>-45a5-810e-cc6157e740fe/src/TestCP1.java:1:
>>cannot access com.google.common.collect.ImmutableList
>>class file for com.google.common.collect.ImmutableList not found
>>import org.apache.hadoop.hbase.coprocessor.*;public class TestCP1
>>extends BaseRegionObserver {}
>>
>>Exact same 2 issues.
>>
>>Here is the related code:
>>    String classpath =
>>        currentDir + File.separator + "target"+ File.separator +
>>"classes" +
>>        System.getProperty("path.separator") +
>>        // Note that the below trick only works if mvn is running the
>>test;
>>        // doesn't work in eclipse for example.
>>        System.getProperty("surefire.test.class.path");
>>
>>That's why it's not working in Eclipse ;)
>>
>>We should read the classpath from eclipse and add it too to this string...
>>
>>JM
>>
>>2013/1/30, Ted <yu...@gmail.com>:
>>> What test failure did you see ?
>>>
>>> Test output would help us understand.
>>>
>>> Btw jdk in eclipse is the same as jdk version you use in shell, right ?
>>>
>>> On Jan 30, 2013, at 4:54 AM, Jean-Marc Spaggiari
>>><je...@spaggiari.org>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> JUnit tests are failing in Eclipse for TestClassLoading but are
>>>> working fine with mvn command line.
>>>>
>>>> Does anyone know why and how to fix that?
>>>>
>>>> JM
>>>
>
>

Re: org.apache.hadoop.hbase.coprocessor.TestClassLoading failing in Eclipse, not in shell...

Posted by Adrian Muraru <am...@adobe.com>.
Hi JM,

You are running the test as a pure Junit test in eclipse right?
This is expected given the assumption that the test is run through
surefire plugin:
https://github.com/apache/hbase/blob/0.94/src/test/java/org/apache/hadoop/h
base/coprocessor/TestClassLoading.java#L171


Additional class path tweaking is needed there to make it working from
eclipse.

/adrian


On 1/30/13 4:03 PM, "Jean-Marc Spaggiari" <je...@spaggiari.org> wrote:

>Hi Ted,
>
>You have a point for the JVM!
>
>MVN is running with: Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre
>And Eclikpse with /usr/local/jdk1.7.0_05/
>
>I change alligned the 2 to point to 1.7 but I'm still getting the same
>results.
>
>
>From mvn:
>Running org.apache.hadoop.hbase.coprocessor.TestClassLoading
>Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 40.215 sec
>
>
>
>From the eclipse console, for TestClassLoading.testHBase3810 I can see
>this:
>
>2013-01-30 08:46:04,962 DEBUG [main]
>coprocessor.TestClassLoading(178): Setting classpath to:
>/home/jmspaggi/workspace/hbase/hbase-server/./target/classes:null
>/home/jmspaggi/workspace/hbase/hbase-server/target/test-data/62cedbf2-dfb4
>-4d6c-af05-bd9af0e46c77/src/TestCP1.java:1:
>cannot access com.google.common.collect.ImmutableList
>class file for com.google.common.collect.ImmutableList not found
>import org.apache.hadoop.hbase.coprocessor.*;public class TestCP1
>extends BaseRegionObserver {}
>
>From the eclipse console, for
>TestClassLoading.testClassLoadingFromLibDirInJar I can see this:
>2013-01-30 08:57:24,838 DEBUG [main]
>coprocessor.TestClassLoading(178): Setting classpath to:
>/home/jmspaggi/workspace/hbase/hbase-server/./target/classes:null
>/home/jmspaggi/workspace/hbase/hbase-server/target/test-data/4585d7e8-a341
>-45a5-810e-cc6157e740fe/src/TestCP1.java:1:
>cannot access com.google.common.collect.ImmutableList
>class file for com.google.common.collect.ImmutableList not found
>import org.apache.hadoop.hbase.coprocessor.*;public class TestCP1
>extends BaseRegionObserver {}
>
>Exact same 2 issues.
>
>Here is the related code:
>    String classpath =
>        currentDir + File.separator + "target"+ File.separator +
>"classes" +
>        System.getProperty("path.separator") +
>        // Note that the below trick only works if mvn is running the
>test;
>        // doesn't work in eclipse for example.
>        System.getProperty("surefire.test.class.path");
>
>That's why it's not working in Eclipse ;)
>
>We should read the classpath from eclipse and add it too to this string...
>
>JM
>
>2013/1/30, Ted <yu...@gmail.com>:
>> What test failure did you see ?
>>
>> Test output would help us understand.
>>
>> Btw jdk in eclipse is the same as jdk version you use in shell, right ?
>>
>> On Jan 30, 2013, at 4:54 AM, Jean-Marc Spaggiari
>><je...@spaggiari.org>
>> wrote:
>>
>>> Hi,
>>>
>>> JUnit tests are failing in Eclipse for TestClassLoading but are
>>> working fine with mvn command line.
>>>
>>> Does anyone know why and how to fix that?
>>>
>>> JM
>>


Re: org.apache.hadoop.hbase.coprocessor.TestClassLoading failing in Eclipse, not in shell...

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Hi Ted,

You have a point for the JVM!

MVN is running with: Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre
And Eclikpse with /usr/local/jdk1.7.0_05/

I change alligned the 2 to point to 1.7 but I'm still getting the same results.


>From mvn:
Running org.apache.hadoop.hbase.coprocessor.TestClassLoading
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 40.215 sec



>From the eclipse console, for TestClassLoading.testHBase3810 I can see this:

2013-01-30 08:46:04,962 DEBUG [main]
coprocessor.TestClassLoading(178): Setting classpath to:
/home/jmspaggi/workspace/hbase/hbase-server/./target/classes:null
/home/jmspaggi/workspace/hbase/hbase-server/target/test-data/62cedbf2-dfb4-4d6c-af05-bd9af0e46c77/src/TestCP1.java:1:
cannot access com.google.common.collect.ImmutableList
class file for com.google.common.collect.ImmutableList not found
import org.apache.hadoop.hbase.coprocessor.*;public class TestCP1
extends BaseRegionObserver {}

>From the eclipse console, for
TestClassLoading.testClassLoadingFromLibDirInJar I can see this:
2013-01-30 08:57:24,838 DEBUG [main]
coprocessor.TestClassLoading(178): Setting classpath to:
/home/jmspaggi/workspace/hbase/hbase-server/./target/classes:null
/home/jmspaggi/workspace/hbase/hbase-server/target/test-data/4585d7e8-a341-45a5-810e-cc6157e740fe/src/TestCP1.java:1:
cannot access com.google.common.collect.ImmutableList
class file for com.google.common.collect.ImmutableList not found
import org.apache.hadoop.hbase.coprocessor.*;public class TestCP1
extends BaseRegionObserver {}

Exact same 2 issues.

Here is the related code:
    String classpath =
        currentDir + File.separator + "target"+ File.separator + "classes" +
        System.getProperty("path.separator") +
        // Note that the below trick only works if mvn is running the test;
        // doesn't work in eclipse for example.
        System.getProperty("surefire.test.class.path");

That's why it's not working in Eclipse ;)

We should read the classpath from eclipse and add it too to this string...

JM

2013/1/30, Ted <yu...@gmail.com>:
> What test failure did you see ?
>
> Test output would help us understand.
>
> Btw jdk in eclipse is the same as jdk version you use in shell, right ?
>
> On Jan 30, 2013, at 4:54 AM, Jean-Marc Spaggiari <je...@spaggiari.org>
> wrote:
>
>> Hi,
>>
>> JUnit tests are failing in Eclipse for TestClassLoading but are
>> working fine with mvn command line.
>>
>> Does anyone know why and how to fix that?
>>
>> JM
>

Re: org.apache.hadoop.hbase.coprocessor.TestClassLoading failing in Eclipse, not in shell...

Posted by Ted <yu...@gmail.com>.
What test failure did you see ?

Test output would help us understand. 

Btw jdk in eclipse is the same as jdk version you use in shell, right ?

On Jan 30, 2013, at 4:54 AM, Jean-Marc Spaggiari <je...@spaggiari.org> wrote:

> Hi,
> 
> JUnit tests are failing in Eclipse for TestClassLoading but are
> working fine with mvn command line.
> 
> Does anyone know why and how to fix that?
> 
> JM