You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Wojciech Langiewicz <wl...@gmail.com> on 2010/08/18 12:08:42 UTC

Classpath problem when running Java scanner

Hello,
I tried to write custom HBase scanner in Java. It compiles successfully, 
but I have problem with running it. I always get exception:
Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/hadoop/hbase/HBaseConfiguration
	at AdserverLogsScanner.<init>(AdserverLogsScanner.java:28)
	at AdserverLogsScanner.main(AdserverLogsScanner.java:70)
Caused by: java.lang.ClassNotFoundException: 
org.apache.hadoop.hbase.HBaseConfiguration
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	... 2 more
this is the line that is causing it:
28: config = HBaseConfiguration.create();
I'm using new API for that.

I have HBase working (I've used shell and web interface on this setup) 
and I have added correct classpath to this class (jar):
System.setProperty("java.class.path", 
"/usr/lib/hbase/*:/usr/lib/hadoop/*:.");
(with this classpath it compiles)

Please help me, because I can't possibly see that is wrong here.
Thank you in advance for any answers and comments.
--
Wojciech Langiewicz

Re: Classpath problem when running Java scanner

Posted by Wojciech Langiewicz <wl...@gmail.com>.
Thanks for the link. My problem was that I was setting classpatch using 
-classpath option and running jar, what causes -classpath option to be 
ignored.

I have added jars in manifest file and this works. Thanks again:)

W dniu 18.08.2010 17:05, Jean-Daniel Cryans pisze:
> See http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath
>
> J-D
>
> On Wed, Aug 18, 2010 at 7:50 AM, Wojciech Langiewicz
> <wl...@gmail.com>  wrote:
>> No, I can't. But I have successfully run this code inside eclipse, and I
>> don't know what is wrong. This is my classpath for this case:
>>
>> /usr/lib/hbase/*:/usr/lib/hadoop/*:.
>>
>> all jars are there since installation, what should I do?
>>
>> W dniu 18.08.2010 16:05, Jean-Daniel Cryans pisze:
>>>
>>> If it really is, can you access other HBase classes like HTable or
>>> HBaseAdmin?
>>>
>>> J-D
>>>
>>> On Wed, Aug 18, 2010 at 6:56 AM, Wojciech Langiewicz
>>> <wl...@gmail.com>    wrote:
>>>>
>>>> Of course this looks like HBase jar is not on the classpath, but it is -
>>>> my
>>>> source file compiles with the same classpath settings.
>>>>
>>>> W dniu 18.08.2010 15:50, Jean-Daniel Cryans pisze:
>>>>>
>>>>> It looks like the hbase jar isn't on your classpath, else it would
>>>>> find HBaseConfiguration.
>>>>>
>>>>> J-D
>>>>>
>>>>> On Wed, Aug 18, 2010 at 3:08 AM, Wojciech Langiewicz
>>>>> <wl...@gmail.com>      wrote:
>>>>>>
>>>>>> Hello,
>>>>>> I tried to write custom HBase scanner in Java. It compiles
>>>>>> successfully,
>>>>>> but
>>>>>> I have problem with running it. I always get exception:
>>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>>> org/apache/hadoop/hbase/HBaseConfiguration
>>>>>>         at AdserverLogsScanner.<init>(AdserverLogsScanner.java:28)
>>>>>>         at AdserverLogsScanner.main(AdserverLogsScanner.java:70)
>>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>>> org.apache.hadoop.hbase.HBaseConfiguration
>>>>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>>>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>>>>>         ... 2 more
>>>>>> this is the line that is causing it:
>>>>>> 28: config = HBaseConfiguration.create();
>>>>>> I'm using new API for that.
>>>>>>
>>>>>> I have HBase working (I've used shell and web interface on this setup)
>>>>>> and I
>>>>>> have added correct classpath to this class (jar):
>>>>>> System.setProperty("java.class.path",
>>>>>> "/usr/lib/hbase/*:/usr/lib/hadoop/*:.");
>>>>>> (with this classpath it compiles)
>>>>>>
>>>>>> Please help me, because I can't possibly see that is wrong here.
>>>>>> Thank you in advance for any answers and comments.
>>>>>> --
>>>>>> Wojciech Langiewicz
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


Re: Classpath problem when running Java scanner

Posted by Jean-Daniel Cryans <jd...@apache.org>.
See http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath

J-D

On Wed, Aug 18, 2010 at 7:50 AM, Wojciech Langiewicz
<wl...@gmail.com> wrote:
> No, I can't. But I have successfully run this code inside eclipse, and I
> don't know what is wrong. This is my classpath for this case:
>
> /usr/lib/hbase/*:/usr/lib/hadoop/*:.
>
> all jars are there since installation, what should I do?
>
> W dniu 18.08.2010 16:05, Jean-Daniel Cryans pisze:
>>
>> If it really is, can you access other HBase classes like HTable or
>> HBaseAdmin?
>>
>> J-D
>>
>> On Wed, Aug 18, 2010 at 6:56 AM, Wojciech Langiewicz
>> <wl...@gmail.com>  wrote:
>>>
>>> Of course this looks like HBase jar is not on the classpath, but it is -
>>> my
>>> source file compiles with the same classpath settings.
>>>
>>> W dniu 18.08.2010 15:50, Jean-Daniel Cryans pisze:
>>>>
>>>> It looks like the hbase jar isn't on your classpath, else it would
>>>> find HBaseConfiguration.
>>>>
>>>> J-D
>>>>
>>>> On Wed, Aug 18, 2010 at 3:08 AM, Wojciech Langiewicz
>>>> <wl...@gmail.com>    wrote:
>>>>>
>>>>> Hello,
>>>>> I tried to write custom HBase scanner in Java. It compiles
>>>>> successfully,
>>>>> but
>>>>> I have problem with running it. I always get exception:
>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>> org/apache/hadoop/hbase/HBaseConfiguration
>>>>>        at AdserverLogsScanner.<init>(AdserverLogsScanner.java:28)
>>>>>        at AdserverLogsScanner.main(AdserverLogsScanner.java:70)
>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>> org.apache.hadoop.hbase.HBaseConfiguration
>>>>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>>>>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>>>>        ... 2 more
>>>>> this is the line that is causing it:
>>>>> 28: config = HBaseConfiguration.create();
>>>>> I'm using new API for that.
>>>>>
>>>>> I have HBase working (I've used shell and web interface on this setup)
>>>>> and I
>>>>> have added correct classpath to this class (jar):
>>>>> System.setProperty("java.class.path",
>>>>> "/usr/lib/hbase/*:/usr/lib/hadoop/*:.");
>>>>> (with this classpath it compiles)
>>>>>
>>>>> Please help me, because I can't possibly see that is wrong here.
>>>>> Thank you in advance for any answers and comments.
>>>>> --
>>>>> Wojciech Langiewicz
>>>>>
>>>>
>>>
>>>
>>
>
>

Re: Classpath problem when running Java scanner

Posted by Wojciech Langiewicz <wl...@gmail.com>.
No, I can't. But I have successfully run this code inside eclipse, and I 
don't know what is wrong. This is my classpath for this case:

/usr/lib/hbase/*:/usr/lib/hadoop/*:.

all jars are there since installation, what should I do?

W dniu 18.08.2010 16:05, Jean-Daniel Cryans pisze:
> If it really is, can you access other HBase classes like HTable or HBaseAdmin?
>
> J-D
>
> On Wed, Aug 18, 2010 at 6:56 AM, Wojciech Langiewicz
> <wl...@gmail.com>  wrote:
>> Of course this looks like HBase jar is not on the classpath, but it is - my
>> source file compiles with the same classpath settings.
>>
>> W dniu 18.08.2010 15:50, Jean-Daniel Cryans pisze:
>>>
>>> It looks like the hbase jar isn't on your classpath, else it would
>>> find HBaseConfiguration.
>>>
>>> J-D
>>>
>>> On Wed, Aug 18, 2010 at 3:08 AM, Wojciech Langiewicz
>>> <wl...@gmail.com>    wrote:
>>>>
>>>> Hello,
>>>> I tried to write custom HBase scanner in Java. It compiles successfully,
>>>> but
>>>> I have problem with running it. I always get exception:
>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>> org/apache/hadoop/hbase/HBaseConfiguration
>>>>         at AdserverLogsScanner.<init>(AdserverLogsScanner.java:28)
>>>>         at AdserverLogsScanner.main(AdserverLogsScanner.java:70)
>>>> Caused by: java.lang.ClassNotFoundException:
>>>> org.apache.hadoop.hbase.HBaseConfiguration
>>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>>>         ... 2 more
>>>> this is the line that is causing it:
>>>> 28: config = HBaseConfiguration.create();
>>>> I'm using new API for that.
>>>>
>>>> I have HBase working (I've used shell and web interface on this setup)
>>>> and I
>>>> have added correct classpath to this class (jar):
>>>> System.setProperty("java.class.path",
>>>> "/usr/lib/hbase/*:/usr/lib/hadoop/*:.");
>>>> (with this classpath it compiles)
>>>>
>>>> Please help me, because I can't possibly see that is wrong here.
>>>> Thank you in advance for any answers and comments.
>>>> --
>>>> Wojciech Langiewicz
>>>>
>>>
>>
>>
>


Re: Classpath problem when running Java scanner

Posted by Jean-Daniel Cryans <jd...@apache.org>.
If it really is, can you access other HBase classes like HTable or HBaseAdmin?

J-D

On Wed, Aug 18, 2010 at 6:56 AM, Wojciech Langiewicz
<wl...@gmail.com> wrote:
> Of course this looks like HBase jar is not on the classpath, but it is - my
> source file compiles with the same classpath settings.
>
> W dniu 18.08.2010 15:50, Jean-Daniel Cryans pisze:
>>
>> It looks like the hbase jar isn't on your classpath, else it would
>> find HBaseConfiguration.
>>
>> J-D
>>
>> On Wed, Aug 18, 2010 at 3:08 AM, Wojciech Langiewicz
>> <wl...@gmail.com>  wrote:
>>>
>>> Hello,
>>> I tried to write custom HBase scanner in Java. It compiles successfully,
>>> but
>>> I have problem with running it. I always get exception:
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/apache/hadoop/hbase/HBaseConfiguration
>>>        at AdserverLogsScanner.<init>(AdserverLogsScanner.java:28)
>>>        at AdserverLogsScanner.main(AdserverLogsScanner.java:70)
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.apache.hadoop.hbase.HBaseConfiguration
>>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>>        ... 2 more
>>> this is the line that is causing it:
>>> 28: config = HBaseConfiguration.create();
>>> I'm using new API for that.
>>>
>>> I have HBase working (I've used shell and web interface on this setup)
>>> and I
>>> have added correct classpath to this class (jar):
>>> System.setProperty("java.class.path",
>>> "/usr/lib/hbase/*:/usr/lib/hadoop/*:.");
>>> (with this classpath it compiles)
>>>
>>> Please help me, because I can't possibly see that is wrong here.
>>> Thank you in advance for any answers and comments.
>>> --
>>> Wojciech Langiewicz
>>>
>>
>
>

Re: Classpath problem when running Java scanner

Posted by Wojciech Langiewicz <wl...@gmail.com>.
Of course this looks like HBase jar is not on the classpath, but it is - 
my source file compiles with the same classpath settings.

W dniu 18.08.2010 15:50, Jean-Daniel Cryans pisze:
> It looks like the hbase jar isn't on your classpath, else it would
> find HBaseConfiguration.
>
> J-D
>
> On Wed, Aug 18, 2010 at 3:08 AM, Wojciech Langiewicz
> <wl...@gmail.com>  wrote:
>> Hello,
>> I tried to write custom HBase scanner in Java. It compiles successfully, but
>> I have problem with running it. I always get exception:
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/apache/hadoop/hbase/HBaseConfiguration
>>         at AdserverLogsScanner.<init>(AdserverLogsScanner.java:28)
>>         at AdserverLogsScanner.main(AdserverLogsScanner.java:70)
>> Caused by: java.lang.ClassNotFoundException:
>> org.apache.hadoop.hbase.HBaseConfiguration
>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>         at java.security.AccessController.doPrivileged(Native Method)
>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>         ... 2 more
>> this is the line that is causing it:
>> 28: config = HBaseConfiguration.create();
>> I'm using new API for that.
>>
>> I have HBase working (I've used shell and web interface on this setup) and I
>> have added correct classpath to this class (jar):
>> System.setProperty("java.class.path",
>> "/usr/lib/hbase/*:/usr/lib/hadoop/*:.");
>> (with this classpath it compiles)
>>
>> Please help me, because I can't possibly see that is wrong here.
>> Thank you in advance for any answers and comments.
>> --
>> Wojciech Langiewicz
>>
>


Re: Classpath problem when running Java scanner

Posted by Jean-Daniel Cryans <jd...@apache.org>.
It looks like the hbase jar isn't on your classpath, else it would
find HBaseConfiguration.

J-D

On Wed, Aug 18, 2010 at 3:08 AM, Wojciech Langiewicz
<wl...@gmail.com> wrote:
> Hello,
> I tried to write custom HBase scanner in Java. It compiles successfully, but
> I have problem with running it. I always get exception:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/hadoop/hbase/HBaseConfiguration
>        at AdserverLogsScanner.<init>(AdserverLogsScanner.java:28)
>        at AdserverLogsScanner.main(AdserverLogsScanner.java:70)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.hadoop.hbase.HBaseConfiguration
>        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        ... 2 more
> this is the line that is causing it:
> 28: config = HBaseConfiguration.create();
> I'm using new API for that.
>
> I have HBase working (I've used shell and web interface on this setup) and I
> have added correct classpath to this class (jar):
> System.setProperty("java.class.path",
> "/usr/lib/hbase/*:/usr/lib/hadoop/*:.");
> (with this classpath it compiles)
>
> Please help me, because I can't possibly see that is wrong here.
> Thank you in advance for any answers and comments.
> --
> Wojciech Langiewicz
>