You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ruchir Jha <ru...@gmail.com> on 2014/10/06 18:01:59 UTC

ConnectionException while trying to connect with Astyanax over Java driver

All,

I am trying to use the new astyanax over java driver to connect to
cassandra version 1.2.12,

Following settings are turned on in cassandra.yaml:

start_rpc: true
native_transport_port: 9042
start_native_transport: true

*Code to connect:*

final Supplier<List<Host>> hostSupplier = new Supplier<List<Host>>() {

            @Override
            public List<Host> get()
            {
                List<Host> hosts = new ArrayList<>();
                for(String hostPort :
StringUtil.getSetFromDelimitedString(seedHosts, ","))
                {
                    String[] pair = hostPort.split(":");
                    Host host = new Host(pair[0],
Integer.valueOf(pair[1]).intValue());
                    host.setRack("rack1");
                    hosts.add(host);
                }
                return hosts;
            }
        };

        // get keyspace
        AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
                .forCluster(clusterName)
                .forKeyspace(keyspace)
                .withHostSupplier(hostSupplier)
                .withAstyanaxConfiguration(
                        new AstyanaxConfigurationImpl()

.setDiscoveryType(NodeDiscoveryType.DISCOVERY_SERVICE)

.setDiscoveryDelayInSeconds(60000).setCqlVersion("3.0.0").setTargetCassandraVersion("1.2.12")
                )
                .withConnectionPoolConfiguration(
                        new *JavaDriverConfigBuilder*().withPort(9042)
                                .build())
                .buildKeyspace(CqlFamilyFactory.getInstance());

        context.start();

*Exception in Cassandra Server logs:*

 WARN [New I/O server boss #1 ([id: 0x6815d6c5, /0.0.0.0:9042])] 2014-10-06
11:11:37,826 Slf4JLogger.java (line 82) Failed to accept a connection.
java.lang.NoSuchMethodError:
org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder.<init>(IIIIIZ)V
        at
org.apache.cassandra.transport.Frame$Decoder.<init>(Frame.java:147)
        at
org.apache.cassandra.transport.Server$PipelineFactory.getPipeline(Server.java:232)
        at
org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.registerAcceptedChannel(NioServerSocketPipelineSink.java:276)
        at
org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.run(NioServerSocketPipelineSink.java:246)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at java.lang.Thread.run(Thread.java:662)


I also tried using the Java Driver 2.1.1, but I see the
NoHostAvailableException, and I feel the underlying reason is the same as
during connecting with astyanax java driver.

Re: ConnectionException while trying to connect with Astyanax over Java driver

Posted by Ruchir Jha <ru...@gmail.com>.
That exception is on the cassandra server and not on the client.

On Mon, Oct 6, 2014 at 2:10 PM, DuyHai Doan <do...@gmail.com> wrote:

> java.lang.NoSuchMethodError -> Jar dependency issue probably. Did you try
> to create an issue on the Astyanax github repo ?
>
> On Mon, Oct 6, 2014 at 6:01 PM, Ruchir Jha <ru...@gmail.com> wrote:
>
>> All,
>>
>> I am trying to use the new astyanax over java driver to connect to
>> cassandra version 1.2.12,
>>
>> Following settings are turned on in cassandra.yaml:
>>
>> start_rpc: true
>> native_transport_port: 9042
>> start_native_transport: true
>>
>> *Code to connect:*
>>
>> final Supplier<List<Host>> hostSupplier = new Supplier<List<Host>>() {
>>
>>             @Override
>>             public List<Host> get()
>>             {
>>                 List<Host> hosts = new ArrayList<>();
>>                 for(String hostPort :
>> StringUtil.getSetFromDelimitedString(seedHosts, ","))
>>                 {
>>                     String[] pair = hostPort.split(":");
>>                     Host host = new Host(pair[0],
>> Integer.valueOf(pair[1]).intValue());
>>                     host.setRack("rack1");
>>                     hosts.add(host);
>>                 }
>>                 return hosts;
>>             }
>>         };
>>
>>         // get keyspace
>>         AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
>>                 .forCluster(clusterName)
>>                 .forKeyspace(keyspace)
>>                 .withHostSupplier(hostSupplier)
>>                 .withAstyanaxConfiguration(
>>                         new AstyanaxConfigurationImpl()
>>
>> .setDiscoveryType(NodeDiscoveryType.DISCOVERY_SERVICE)
>>
>> .setDiscoveryDelayInSeconds(60000).setCqlVersion("3.0.0").setTargetCassandraVersion("1.2.12")
>>                 )
>>                 .withConnectionPoolConfiguration(
>>                         new *JavaDriverConfigBuilder*().withPort(9042)
>>                                 .build())
>>                 .buildKeyspace(CqlFamilyFactory.getInstance());
>>
>>         context.start();
>>
>> *Exception in Cassandra Server logs:*
>>
>>  WARN [New I/O server boss #1 ([id: 0x6815d6c5, /0.0.0.0:9042])]
>> 2014-10-06 11:11:37,826 Slf4JLogger.java (line 82) Failed to accept a
>> connection.
>> java.lang.NoSuchMethodError:
>> org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder.<init>(IIIIIZ)V
>>         at
>> org.apache.cassandra.transport.Frame$Decoder.<init>(Frame.java:147)
>>         at
>> org.apache.cassandra.transport.Server$PipelineFactory.getPipeline(Server.java:232)
>>         at
>> org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.registerAcceptedChannel(NioServerSocketPipelineSink.java:276)
>>         at
>> org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.run(NioServerSocketPipelineSink.java:246)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>>         at java.lang.Thread.run(Thread.java:662)
>>
>>
>> I also tried using the Java Driver 2.1.1, but I see the
>> NoHostAvailableException, and I feel the underlying reason is the same as
>> during connecting with astyanax java driver.
>>
>>
>

Re: ConnectionException while trying to connect with Astyanax over Java driver

Posted by DuyHai Doan <do...@gmail.com>.
java.lang.NoSuchMethodError -> Jar dependency issue probably. Did you try
to create an issue on the Astyanax github repo ?

On Mon, Oct 6, 2014 at 6:01 PM, Ruchir Jha <ru...@gmail.com> wrote:

> All,
>
> I am trying to use the new astyanax over java driver to connect to
> cassandra version 1.2.12,
>
> Following settings are turned on in cassandra.yaml:
>
> start_rpc: true
> native_transport_port: 9042
> start_native_transport: true
>
> *Code to connect:*
>
> final Supplier<List<Host>> hostSupplier = new Supplier<List<Host>>() {
>
>             @Override
>             public List<Host> get()
>             {
>                 List<Host> hosts = new ArrayList<>();
>                 for(String hostPort :
> StringUtil.getSetFromDelimitedString(seedHosts, ","))
>                 {
>                     String[] pair = hostPort.split(":");
>                     Host host = new Host(pair[0],
> Integer.valueOf(pair[1]).intValue());
>                     host.setRack("rack1");
>                     hosts.add(host);
>                 }
>                 return hosts;
>             }
>         };
>
>         // get keyspace
>         AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
>                 .forCluster(clusterName)
>                 .forKeyspace(keyspace)
>                 .withHostSupplier(hostSupplier)
>                 .withAstyanaxConfiguration(
>                         new AstyanaxConfigurationImpl()
>
> .setDiscoveryType(NodeDiscoveryType.DISCOVERY_SERVICE)
>
> .setDiscoveryDelayInSeconds(60000).setCqlVersion("3.0.0").setTargetCassandraVersion("1.2.12")
>                 )
>                 .withConnectionPoolConfiguration(
>                         new *JavaDriverConfigBuilder*().withPort(9042)
>                                 .build())
>                 .buildKeyspace(CqlFamilyFactory.getInstance());
>
>         context.start();
>
> *Exception in Cassandra Server logs:*
>
>  WARN [New I/O server boss #1 ([id: 0x6815d6c5, /0.0.0.0:9042])]
> 2014-10-06 11:11:37,826 Slf4JLogger.java (line 82) Failed to accept a
> connection.
> java.lang.NoSuchMethodError:
> org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder.<init>(IIIIIZ)V
>         at
> org.apache.cassandra.transport.Frame$Decoder.<init>(Frame.java:147)
>         at
> org.apache.cassandra.transport.Server$PipelineFactory.getPipeline(Server.java:232)
>         at
> org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.registerAcceptedChannel(NioServerSocketPipelineSink.java:276)
>         at
> org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.run(NioServerSocketPipelineSink.java:246)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>         at java.lang.Thread.run(Thread.java:662)
>
>
> I also tried using the Java Driver 2.1.1, but I see the
> NoHostAvailableException, and I feel the underlying reason is the same as
> during connecting with astyanax java driver.
>
>