You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by "kondo@vivinavi.com" <ko...@vivinavi.com> on 2011/02/24 20:53:21 UTC

Exception in thread "main" java.lang.NoClassDefFoundError

Hi everyone

I am new to JAVA and Cassandra.
I just get started to install Cassandra.
My Machine is Debian 5.0.6.
I installed jdk1.6.0_24 to /usr/local
java -version is as following.
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)
javac -J-version is as following.
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

and then I installed apache-cassandra-0.6.12 to /user/local

I add the following PATH on /etc/profile
#for Java
export JAVA_HOME="/usr/local/java"
export CLASSPATH=".:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar;"
export PATH="$JAVA_HOME/bin:$PATH"

#for Java VM
export JVM_OPTS="-Xmx1G -Xms512M -Xss256K"

#for Cassandra
export CASSANDRA_HOME="/usr/local/cassandra/bin"
export CASSANDRA_CONF="/usr/local/cassandra/conf"
export
CASSANDRA_MAIN="/usr/local/cassandra/javadoc/org/apache/cassandra/thrift/CassandraDaemon.html"
export CASSANDRA_INCLUDE="/usr/local/cassandra/bin/cassandra.in.sh"
export PATH="$PATH:/usr/local/cassandra/bin"

I did source /etc/profile.
And checked $JAVA_HOME,$CLASS_PATH,$CASSANDRA_HOME etc.

And then I started /usr/local/cassandra/bin/cassandra -f
However I met the following Error message.

Exception in thread "main" java.lang.NoClassDefFoundError:
/usr/local/cassandra/javadoc/org/apache/cassandra/thrift/CassandraDaemon
Caused by: java.lang.ClassNotFoundException:
.usr.local.cassandra.javadoc.org.apache.cassandra.thrift.CassandraDaemon
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)
Could not find the main class:
.usr.local.cassandra.javadoc.org.apache.cassandra.thrift.CassandraDaemon. Program
will exit.

I don't know what's wrong?
I don't know what to do to solve this problem.
I searched this error message and then found it but mostly for Win not
Linux.
My classpath is wrong? I can find only many html(inc.
CassandraDaemon.html) files
at /usr/local/cassandra/javadoc/org/apache/cassandra/thrift/.
Is this OK?
if my classpath is wrong , what is a correct path? (I can't find
CassandraDaemon.java)

Please advise me to solve this problem.
Thank you for your help in advance.

Best Regards
Mac Kondo

-- 
*************************
Mamoru Kondo
Vivid Navigation,Inc.
http://www.vivinavi.com
kondo@vivinavi.com
*************************


Re: TException: Error: TSocket read 0 bytes

Posted by aaron morton <aa...@thelastpickle.com>.
Just checking the version of Thrift, you said 0.7.2 the latest stable is 0.6

Unfortunately for cassandra 0.6 you need to match a specific SVN release for thrift see http://wiki.apache.org/cassandra/InstallThrift  For cassandra 0.6.12 it's r917130

Is there a reason you are using cassandra 0.6.12 ? There are many fine reasons to go with 0.7 including use of phpcassa https://github.com/thobbs/phpcassa and the use of stable packed thrift releases. Also the upgrade path from 0.6.X to 0.7.X requires a full cluster shutdown.

Hope that helps. 
Aaron

On 8/03/2011, at 5:02 PM, kondo@vivinavi.com wrote:

> Hi Jonathan Ellis
> 
> Thank you for your advice.
> It was useful for me but I have still other problem.
> Now Cassandra 0.6.12 is working.
> So I installed Thrift 0.7.2 for PHP interface.
> Then I tried an example program from Cassandra Wiki ThriftExamples.
> However fread or fwrite in TSocket.php doesn't work.
> Then "TException: Error: TSocket read 0 bytes" error has occured.
> I checked the resource ID of fsockopen.(Resource id #11)
> And I checked the data in Keyspace by get command on Cassandra-cli.
> (port 9160 is open for cassandra.)
> So I don't know why fread doesn't work.
> As I thought Thrift doesn't work, I re-configureed and make.
> But still same problem happened.
> My Machine OS is Debian 5.0.6.
> So what is wrong or what I have to check?
> 
> Thank you for your advice in advance.
> 
> Mac Kondo
> 
> 
> (2011/02/25 7:28), Jonathan Ellis wrote:
>> http://wiki.apache.org/cassandra/RunningCassandra may be useful, but
>> really you should be using the debian package:
>> http://wiki.apache.org/cassandra/DebianPackaging
>> 
>> 2011/2/24 kondo@vivinavi.com<ko...@vivinavi.com>:
>>> Hi everyone
>>> 
>>> I am new to JAVA and Cassandra.
>>> I just get started to install Cassandra.
>>> My Machine is Debian 5.0.6.
>>> I installed jdk1.6.0_24 to /usr/local
>>> java -version is as following.
>>> java version "1.6.0_24"
>>> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
>>> Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)
>>> javac -J-version is as following.
>>> java version "1.6.0_24"
>>> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
>>> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>>> 
>>> and then I installed apache-cassandra-0.6.12 to /user/local
>>> 
>>> I add the following PATH on /etc/profile
>>> #for Java
>>> export JAVA_HOME="/usr/local/java"
>>> export CLASSPATH=".:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar;"
>>> export PATH="$JAVA_HOME/bin:$PATH"
>>> 
>>> #for Java VM
>>> export JVM_OPTS="-Xmx1G -Xms512M -Xss256K"
>>> 
>>> #for Cassandra
>>> export CASSANDRA_HOME="/usr/local/cassandra/bin"
>>> export CASSANDRA_CONF="/usr/local/cassandra/conf"
>>> export
>>> CASSANDRA_MAIN="/usr/local/cassandra/javadoc/org/apache/cassandra/thrift/CassandraDaemon.html"
>>> export CASSANDRA_INCLUDE="/usr/local/cassandra/bin/cassandra.in.sh"
>>> export PATH="$PATH:/usr/local/cassandra/bin"
>>> 
>>> I did source /etc/profile.
>>> And checked $JAVA_HOME,$CLASS_PATH,$CASSANDRA_HOME etc.
>>> 
>>> And then I started /usr/local/cassandra/bin/cassandra -f
>>> However I met the following Error message.
>>> 
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> /usr/local/cassandra/javadoc/org/apache/cassandra/thrift/CassandraDaemon
>>> Caused by: java.lang.ClassNotFoundException:
>>> .usr.local.cassandra.javadoc.org.apache.cassandra.thrift.CassandraDaemon
>>> 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)
>>> Could not find the main class:
>>> .usr.local.cassandra.javadoc.org.apache.cassandra.thrift.CassandraDaemon. Program
>>> will exit.
>>> 
>>> I don't know what's wrong?
>>> I don't know what to do to solve this problem.
>>> I searched this error message and then found it but mostly for Win not
>>> Linux.
>>> My classpath is wrong? I can find only many html(inc.
>>> CassandraDaemon.html) files
>>> at /usr/local/cassandra/javadoc/org/apache/cassandra/thrift/.
>>> Is this OK?
>>> if my classpath is wrong , what is a correct path? (I can't find
>>> CassandraDaemon.java)
>>> 
>>> Please advise me to solve this problem.
>>> Thank you for your help in advance.
>>> 
>>> Best Regards
>>> Mac Kondo
>>> 
>>> --
>>> *************************
>>> Mamoru Kondo
>>> Vivid Navigation,Inc.
>>> http://www.vivinavi.com
>>> kondo@vivinavi.com
>>> *************************
>>> 
>>> 
>> 
>> 
> 
> 
> -- 
> *************************
> Mamoru Kondo
> Vivid Navigation,Inc.
> http://www.vivinavi.com
> kondo@vivinavi.com
> Office:310-326-2900
> Fax:310-257-0051
> *************************
> 


TException: Error: TSocket read 0 bytes

Posted by "kondo@vivinavi.com" <ko...@vivinavi.com>.
Hi Jonathan Ellis

Thank you for your advice.
It was useful for me but I have still other problem.
Now Cassandra 0.6.12 is working.
So I installed Thrift 0.7.2 for PHP interface.
Then I tried an example program from Cassandra Wiki ThriftExamples.
However fread or fwrite in TSocket.php doesn't work.
Then "TException: Error: TSocket read 0 bytes" error has occured.
I checked the resource ID of fsockopen.(Resource id #11)
And I checked the data in Keyspace by get command on Cassandra-cli.
(port 9160 is open for cassandra.)
So I don't know why fread doesn't work.
As I thought Thrift doesn't work, I re-configureed and make.
But still same problem happened.
My Machine OS is Debian 5.0.6.
So what is wrong or what I have to check?

Thank you for your advice in advance.

Mac Kondo


(2011/02/25 7:28), Jonathan Ellis wrote:
> http://wiki.apache.org/cassandra/RunningCassandra may be useful, but
> really you should be using the debian package:
> http://wiki.apache.org/cassandra/DebianPackaging
>
> 2011/2/24 kondo@vivinavi.com<ko...@vivinavi.com>:
>> Hi everyone
>>
>> I am new to JAVA and Cassandra.
>> I just get started to install Cassandra.
>> My Machine is Debian 5.0.6.
>> I installed jdk1.6.0_24 to /usr/local
>> java -version is as following.
>> java version "1.6.0_24"
>> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
>> Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)
>> javac -J-version is as following.
>> java version "1.6.0_24"
>> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
>> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>>
>> and then I installed apache-cassandra-0.6.12 to /user/local
>>
>> I add the following PATH on /etc/profile
>> #for Java
>> export JAVA_HOME="/usr/local/java"
>> export CLASSPATH=".:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar;"
>> export PATH="$JAVA_HOME/bin:$PATH"
>>
>> #for Java VM
>> export JVM_OPTS="-Xmx1G -Xms512M -Xss256K"
>>
>> #for Cassandra
>> export CASSANDRA_HOME="/usr/local/cassandra/bin"
>> export CASSANDRA_CONF="/usr/local/cassandra/conf"
>> export
>> CASSANDRA_MAIN="/usr/local/cassandra/javadoc/org/apache/cassandra/thrift/CassandraDaemon.html"
>> export CASSANDRA_INCLUDE="/usr/local/cassandra/bin/cassandra.in.sh"
>> export PATH="$PATH:/usr/local/cassandra/bin"
>>
>> I did source /etc/profile.
>> And checked $JAVA_HOME,$CLASS_PATH,$CASSANDRA_HOME etc.
>>
>> And then I started /usr/local/cassandra/bin/cassandra -f
>> However I met the following Error message.
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> /usr/local/cassandra/javadoc/org/apache/cassandra/thrift/CassandraDaemon
>> Caused by: java.lang.ClassNotFoundException:
>> .usr.local.cassandra.javadoc.org.apache.cassandra.thrift.CassandraDaemon
>> 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)
>> Could not find the main class:
>> .usr.local.cassandra.javadoc.org.apache.cassandra.thrift.CassandraDaemon. Program
>> will exit.
>>
>> I don't know what's wrong?
>> I don't know what to do to solve this problem.
>> I searched this error message and then found it but mostly for Win not
>> Linux.
>> My classpath is wrong? I can find only many html(inc.
>> CassandraDaemon.html) files
>> at /usr/local/cassandra/javadoc/org/apache/cassandra/thrift/.
>> Is this OK?
>> if my classpath is wrong , what is a correct path? (I can't find
>> CassandraDaemon.java)
>>
>> Please advise me to solve this problem.
>> Thank you for your help in advance.
>>
>> Best Regards
>> Mac Kondo
>>
>> --
>> *************************
>> Mamoru Kondo
>> Vivid Navigation,Inc.
>> http://www.vivinavi.com
>> kondo@vivinavi.com
>> *************************
>>
>>
>
>


-- 
*************************
Mamoru Kondo
Vivid Navigation,Inc.
http://www.vivinavi.com
kondo@vivinavi.com
Office:310-326-2900
Fax:310-257-0051
*************************


Re: Exception in thread "main" java.lang.NoClassDefFoundError

Posted by Jonathan Ellis <jb...@gmail.com>.
http://wiki.apache.org/cassandra/RunningCassandra may be useful, but
really you should be using the debian package:
http://wiki.apache.org/cassandra/DebianPackaging

2011/2/24 kondo@vivinavi.com <ko...@vivinavi.com>:
> Hi everyone
>
> I am new to JAVA and Cassandra.
> I just get started to install Cassandra.
> My Machine is Debian 5.0.6.
> I installed jdk1.6.0_24 to /usr/local
> java -version is as following.
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)
> javac -J-version is as following.
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>
> and then I installed apache-cassandra-0.6.12 to /user/local
>
> I add the following PATH on /etc/profile
> #for Java
> export JAVA_HOME="/usr/local/java"
> export CLASSPATH=".:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar;"
> export PATH="$JAVA_HOME/bin:$PATH"
>
> #for Java VM
> export JVM_OPTS="-Xmx1G -Xms512M -Xss256K"
>
> #for Cassandra
> export CASSANDRA_HOME="/usr/local/cassandra/bin"
> export CASSANDRA_CONF="/usr/local/cassandra/conf"
> export
> CASSANDRA_MAIN="/usr/local/cassandra/javadoc/org/apache/cassandra/thrift/CassandraDaemon.html"
> export CASSANDRA_INCLUDE="/usr/local/cassandra/bin/cassandra.in.sh"
> export PATH="$PATH:/usr/local/cassandra/bin"
>
> I did source /etc/profile.
> And checked $JAVA_HOME,$CLASS_PATH,$CASSANDRA_HOME etc.
>
> And then I started /usr/local/cassandra/bin/cassandra -f
> However I met the following Error message.
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> /usr/local/cassandra/javadoc/org/apache/cassandra/thrift/CassandraDaemon
> Caused by: java.lang.ClassNotFoundException:
> .usr.local.cassandra.javadoc.org.apache.cassandra.thrift.CassandraDaemon
> 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)
> Could not find the main class:
> .usr.local.cassandra.javadoc.org.apache.cassandra.thrift.CassandraDaemon. Program
> will exit.
>
> I don't know what's wrong?
> I don't know what to do to solve this problem.
> I searched this error message and then found it but mostly for Win not
> Linux.
> My classpath is wrong? I can find only many html(inc.
> CassandraDaemon.html) files
> at /usr/local/cassandra/javadoc/org/apache/cassandra/thrift/.
> Is this OK?
> if my classpath is wrong , what is a correct path? (I can't find
> CassandraDaemon.java)
>
> Please advise me to solve this problem.
> Thank you for your help in advance.
>
> Best Regards
> Mac Kondo
>
> --
> *************************
> Mamoru Kondo
> Vivid Navigation,Inc.
> http://www.vivinavi.com
> kondo@vivinavi.com
> *************************
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com