You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Cassy Andra <ca...@gmail.com> on 2011/01/11 02:19:01 UTC

Need some beginner help with Eclipse+Hector with Cassandra 0.7

Hi,

I'm trying to use Eclipse with Hector (latest version) to write a new row to
Cassandra 0.7RC4. However, I keep getting a Java error. Any


Here is the .java file:
- - - - - -
import me.prettyprint.cassandra.serializers.StringSerializer;
import me.prettyprint.cassandra.service.CassandraHostConfigurator;
import me.prettyprint.hector.api.Cluster;
import me.prettyprint.hector.api.Keyspace;
import me.prettyprint.hector.api.factory.HFactory;
import me.prettyprint.hector.api.mutation.Mutator;

class HelloWorldApp {
    private static StringSerializer stringSerializer =
StringSerializer.get();
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.

            Cluster cluster = HFactory.getOrCreateCluster("Test Cluster",
new CassandraHostConfigurator("170.252.179.233:9160"));
            Keyspace keyspace = HFactory.createKeyspace("SameerKey",
cluster);
            Mutator<String> mutator = HFactory.createMutator(keyspace,
stringSerializer);
            mutator.insert("cat", "Pets",
HFactory.createStringColumn("says", "meow"));

    }
}
- - - - - - - -

Error:

Hello World!
log4j:WARN No appenders could be found for logger
(me.prettyprint.cassandra.connection.CassandraHostRetryService).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:

    The import org.apache.commons.pool cannot be resolved
    GenericObjectPool cannot be resolved to a variable
    GenericObjectPool cannot be resolved to a variable
    GenericObjectPool cannot be resolved to a variable

    at
me.prettyprint.cassandra.service.CassandraHost.<init>(CassandraHost.java:9)
    at
me.prettyprint.cassandra.service.CassandraHostConfigurator.buildCassandraHosts(CassandraHostConfigurator.java:53)
    at
me.prettyprint.cassandra.connection.HConnectionManager.<init>(HConnectionManager.java:60)
    at
me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:62)
    at
me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:58)
    at
me.prettyprint.cassandra.service.ThriftCluster.<init>(ThriftCluster.java:17)
    at
me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:107)
    at
me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:99)
    at HelloWorldApp.main(test.java:13)


- - - - - -

By the way, the Hector PDF said to add the google-collections library as a
runtime dependency, but I couldn't find v1.0 of this b/c it's been replaced
by Guava. I added Guava r07 to the build path. Also, instead of slf4j-api &
slf4j-log4j 1.5.8, I'm using v1.6.1 (not sure if this matters).

Any ideas?

Re: Need some beginner help with Eclipse+Hector with Cassandra 0.7

Posted by Nate McCall <na...@riptano.com>.
Add "-verbose" to the command-line options for the launch
configuration so you can see the classpath. It sounds like
log4j.properties is not being found. (Depending on your project setup,
you may need to add this file to the classpath explicitly).

On Tue, Jan 11, 2011 at 1:36 PM,  <ta...@accenture.com> wrote:
> What about this logger error? I'm getting it too, and I am also running simple code with Hector and Eclipse:
> log4j:WARN No appenders could be found for logger (me.prettyprint.cassandra.connection.CassandraHostRetryService).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
>
> Went to the site in the error and it says:
> This occurs when the default configuration files log4j.properties and log4j.xml can not be found and the application performs no explicit configuration.
> I don't think it is the problem because those files are where they should be. Any ideas?
>
> Thanks!
>
> -----Original Message-----
> From: Nate McCall [mailto:nate@riptano.com]
> Sent: Monday, January 10, 2011 7:37 PM
> To: user@cassandra.apache.org
> Cc: hector-users@googlegroups.com
> Subject: Re: Need some beginner help with Eclipse+Hector with Cassandra 0.7
>
> Add commons-pooling to the classpath (the remaining references will be
> removed shortly as it is no longer actively used). An updated version
> of the Hector doc will be out shortly to reflect a few minor changes -
> thanks for pointing out this specifically though.
>
> I've cc'ed hector-users@googlegroups.com -  feel free to send
> hector-specific questions here in the future.
>
>
> On Mon, Jan 10, 2011 at 7:19 PM, Cassy Andra <ca...@gmail.com> wrote:
>> Hi,
>>
>> I'm trying to use Eclipse with Hector (latest version) to write a new row to
>> Cassandra 0.7RC4. However, I keep getting a Java error. Any
>>
>>
>> Here is the .java file:
>> - - - - - -
>> import me.prettyprint.cassandra.serializers.StringSerializer;
>> import me.prettyprint.cassandra.service.CassandraHostConfigurator;
>> import me.prettyprint.hector.api.Cluster;
>> import me.prettyprint.hector.api.Keyspace;
>> import me.prettyprint.hector.api.factory.HFactory;
>> import me.prettyprint.hector.api.mutation.Mutator;
>>
>> class HelloWorldApp {
>>     private static StringSerializer stringSerializer =
>> StringSerializer.get();
>>     public static void main(String[] args) {
>>         System.out.println("Hello World!"); // Display the string.
>>
>>             Cluster cluster = HFactory.getOrCreateCluster("Test Cluster",
>> new CassandraHostConfigurator("170.252.179.233:9160"));
>>             Keyspace keyspace = HFactory.createKeyspace("SameerKey",
>> cluster);
>>             Mutator<String> mutator = HFactory.createMutator(keyspace,
>> stringSerializer);
>>             mutator.insert("cat", "Pets",
>> HFactory.createStringColumn("says", "meow"));
>>
>>     }
>> }
>> - - - - - - - -
>>
>> Error:
>>
>> Hello World!
>> log4j:WARN No appenders could be found for logger
>> (me.prettyprint.cassandra.connection.CassandraHostRetryService).
>> log4j:WARN Please initialize the log4j system properly.
>> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
>> more info.
>> Exception in thread "main" java.lang.Error: Unresolved compilation problems:
>>     The import org.apache.commons.pool cannot be resolved
>>     GenericObjectPool cannot be resolved to a variable
>>     GenericObjectPool cannot be resolved to a variable
>>     GenericObjectPool cannot be resolved to a variable
>>
>>     at
>> me.prettyprint.cassandra.service.CassandraHost.<init>(CassandraHost.java:9)
>>     at
>> me.prettyprint.cassandra.service.CassandraHostConfigurator.buildCassandraHosts(CassandraHostConfigurator.java:53)
>>     at
>> me.prettyprint.cassandra.connection.HConnectionManager.<init>(HConnectionManager.java:60)
>>     at
>> me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:62)
>>     at
>> me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:58)
>>     at
>> me.prettyprint.cassandra.service.ThriftCluster.<init>(ThriftCluster.java:17)
>>     at
>> me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:107)
>>     at
>> me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:99)
>>     at HelloWorldApp.main(test.java:13)
>>
>>
>> - - - - - -
>>
>> By the way, the Hector PDF said to add the google-collections library as a
>> runtime dependency, but I couldn't find v1.0 of this b/c it's been replaced
>> by Guava. I added Guava r07 to the build path. Also, instead of slf4j-api &
>> slf4j-log4j 1.5.8, I'm using v1.6.1 (not sure if this matters).
>>
>> Any ideas?
>>
>>
>>
>
>
>
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.
>

RE: Need some beginner help with Eclipse+Hector with Cassandra 0.7

Posted by ta...@accenture.com.
What about this logger error? I'm getting it too, and I am also running simple code with Hector and Eclipse:
log4j:WARN No appenders could be found for logger (me.prettyprint.cassandra.connection.CassandraHostRetryService).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Went to the site in the error and it says: 
This occurs when the default configuration files log4j.properties and log4j.xml can not be found and the application performs no explicit configuration.
I don't think it is the problem because those files are where they should be. Any ideas?

Thanks!

-----Original Message-----
From: Nate McCall [mailto:nate@riptano.com] 
Sent: Monday, January 10, 2011 7:37 PM
To: user@cassandra.apache.org
Cc: hector-users@googlegroups.com
Subject: Re: Need some beginner help with Eclipse+Hector with Cassandra 0.7

Add commons-pooling to the classpath (the remaining references will be
removed shortly as it is no longer actively used). An updated version
of the Hector doc will be out shortly to reflect a few minor changes -
thanks for pointing out this specifically though.

I've cc'ed hector-users@googlegroups.com -  feel free to send
hector-specific questions here in the future.


On Mon, Jan 10, 2011 at 7:19 PM, Cassy Andra <ca...@gmail.com> wrote:
> Hi,
>
> I'm trying to use Eclipse with Hector (latest version) to write a new row to
> Cassandra 0.7RC4. However, I keep getting a Java error. Any
>
>
> Here is the .java file:
> - - - - - -
> import me.prettyprint.cassandra.serializers.StringSerializer;
> import me.prettyprint.cassandra.service.CassandraHostConfigurator;
> import me.prettyprint.hector.api.Cluster;
> import me.prettyprint.hector.api.Keyspace;
> import me.prettyprint.hector.api.factory.HFactory;
> import me.prettyprint.hector.api.mutation.Mutator;
>
> class HelloWorldApp {
>     private static StringSerializer stringSerializer =
> StringSerializer.get();
>     public static void main(String[] args) {
>         System.out.println("Hello World!"); // Display the string.
>
>             Cluster cluster = HFactory.getOrCreateCluster("Test Cluster",
> new CassandraHostConfigurator("170.252.179.233:9160"));
>             Keyspace keyspace = HFactory.createKeyspace("SameerKey",
> cluster);
>             Mutator<String> mutator = HFactory.createMutator(keyspace,
> stringSerializer);
>             mutator.insert("cat", "Pets",
> HFactory.createStringColumn("says", "meow"));
>
>     }
> }
> - - - - - - - -
>
> Error:
>
> Hello World!
> log4j:WARN No appenders could be found for logger
> (me.prettyprint.cassandra.connection.CassandraHostRetryService).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.
> Exception in thread "main" java.lang.Error: Unresolved compilation problems:
>     The import org.apache.commons.pool cannot be resolved
>     GenericObjectPool cannot be resolved to a variable
>     GenericObjectPool cannot be resolved to a variable
>     GenericObjectPool cannot be resolved to a variable
>
>     at
> me.prettyprint.cassandra.service.CassandraHost.<init>(CassandraHost.java:9)
>     at
> me.prettyprint.cassandra.service.CassandraHostConfigurator.buildCassandraHosts(CassandraHostConfigurator.java:53)
>     at
> me.prettyprint.cassandra.connection.HConnectionManager.<init>(HConnectionManager.java:60)
>     at
> me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:62)
>     at
> me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:58)
>     at
> me.prettyprint.cassandra.service.ThriftCluster.<init>(ThriftCluster.java:17)
>     at
> me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:107)
>     at
> me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:99)
>     at HelloWorldApp.main(test.java:13)
>
>
> - - - - - -
>
> By the way, the Hector PDF said to add the google-collections library as a
> runtime dependency, but I couldn't find v1.0 of this b/c it's been replaced
> by Guava. I added Guava r07 to the build path. Also, instead of slf4j-api &
> slf4j-log4j 1.5.8, I'm using v1.6.1 (not sure if this matters).
>
> Any ideas?
>
>
>



This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

Re: Need some beginner help with Eclipse+Hector with Cassandra 0.7

Posted by Nate McCall <na...@riptano.com>.
Add commons-pooling to the classpath (the remaining references will be
removed shortly as it is no longer actively used). An updated version
of the Hector doc will be out shortly to reflect a few minor changes -
thanks for pointing out this specifically though.

I've cc'ed hector-users@googlegroups.com -  feel free to send
hector-specific questions here in the future.


On Mon, Jan 10, 2011 at 7:19 PM, Cassy Andra <ca...@gmail.com> wrote:
> Hi,
>
> I'm trying to use Eclipse with Hector (latest version) to write a new row to
> Cassandra 0.7RC4. However, I keep getting a Java error. Any
>
>
> Here is the .java file:
> - - - - - -
> import me.prettyprint.cassandra.serializers.StringSerializer;
> import me.prettyprint.cassandra.service.CassandraHostConfigurator;
> import me.prettyprint.hector.api.Cluster;
> import me.prettyprint.hector.api.Keyspace;
> import me.prettyprint.hector.api.factory.HFactory;
> import me.prettyprint.hector.api.mutation.Mutator;
>
> class HelloWorldApp {
>     private static StringSerializer stringSerializer =
> StringSerializer.get();
>     public static void main(String[] args) {
>         System.out.println("Hello World!"); // Display the string.
>
>             Cluster cluster = HFactory.getOrCreateCluster("Test Cluster",
> new CassandraHostConfigurator("170.252.179.233:9160"));
>             Keyspace keyspace = HFactory.createKeyspace("SameerKey",
> cluster);
>             Mutator<String> mutator = HFactory.createMutator(keyspace,
> stringSerializer);
>             mutator.insert("cat", "Pets",
> HFactory.createStringColumn("says", "meow"));
>
>     }
> }
> - - - - - - - -
>
> Error:
>
> Hello World!
> log4j:WARN No appenders could be found for logger
> (me.prettyprint.cassandra.connection.CassandraHostRetryService).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.
> Exception in thread "main" java.lang.Error: Unresolved compilation problems:
>     The import org.apache.commons.pool cannot be resolved
>     GenericObjectPool cannot be resolved to a variable
>     GenericObjectPool cannot be resolved to a variable
>     GenericObjectPool cannot be resolved to a variable
>
>     at
> me.prettyprint.cassandra.service.CassandraHost.<init>(CassandraHost.java:9)
>     at
> me.prettyprint.cassandra.service.CassandraHostConfigurator.buildCassandraHosts(CassandraHostConfigurator.java:53)
>     at
> me.prettyprint.cassandra.connection.HConnectionManager.<init>(HConnectionManager.java:60)
>     at
> me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:62)
>     at
> me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:58)
>     at
> me.prettyprint.cassandra.service.ThriftCluster.<init>(ThriftCluster.java:17)
>     at
> me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:107)
>     at
> me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:99)
>     at HelloWorldApp.main(test.java:13)
>
>
> - - - - - -
>
> By the way, the Hector PDF said to add the google-collections library as a
> runtime dependency, but I couldn't find v1.0 of this b/c it's been replaced
> by Guava. I added Guava r07 to the build path. Also, instead of slf4j-api &
> slf4j-log4j 1.5.8, I'm using v1.6.1 (not sure if this matters).
>
> Any ideas?
>
>
>