You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Everton Lima <pe...@gmail.com> on 2012/11/27 12:28:57 UTC

Upgrade

Hello people.
I was using cassandra 1.1.6 and use the Object CassandraServer() to create
keyspaces by my code.

But when I update to version 1.2.0-beta2, my code starts to throw Exception
(NullPointerException) in the method:

*in version 1.1.6*
CassandraServer -> state() ->
 {
       SocketAddress remoteSocket =
SocketSessionManagementService.remoteSocket.get();
       if (remoteSocket == null)
           return clientState.get();

       ClientState cState =
SocketSessionManagementService.instance.get(remoteSocket);
       if (cState == null)
       {
           cState = new ClientState();
           SocketSessionManagementService.instance.put(remoteSocket,
cState);
       }
       return cState;
   }

*in version 1.2.0*
CassandraServer -> state() ->
{
      return ThriftSessionManager.instance.currentSession();
}
currtentSession(){
         SocketAddress socket = remoteSocket.get();
        assert socket != null;

        ThriftClientState cState = activeSocketSessions.get(socket);
        if (cState == null)
        {
            cState = new ThriftClientState();
            activeSocketSessions.put(socket, cState);
        }
        return cState;
}


So, in version 1.1.6, it verify if has  a remote connection, it not it try
to get o local. In the version 1.2.0 it try to get a remote connection and
apply it
to a ThriftClientState, but if does not have a remote connection (like in
1.1.6) it will throw a NullPointerException in line:
ThriftClientState cState = activeSocketSessions.get(socket);

Is any way to use CassandraServer in the new version??

Thanks!

-- 

Everton Lima Aleixo
Bacharel em Ciencia da Computação
Universidade Federal de Goiás

Re: Upgrade

Posted by Everton Lima <pe...@gmail.com>.
Yes.

java.lang.NullPointerException
    at
java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:796)
    at
org.apache.cassandra.thrift.ThriftSessionManager.currentSession(ThriftSessionManager.java:53)
    at
org.apache.cassandra.thrift.CassandraServer.state(CassandraServer.java:88)
    at
org.apache.cassandra.thrift.CassandraServer.system_add_keyspace(CassandraServer.java:1345)
    at
harpia.ns.storage.cassandra.CassandraHelper.setupKeyspace(CassandraHelper.java:179)
    at
harpia.ns.storage.cassandra.CassandraHelper.startInstance(CassandraHelper.java:154)
    at
harpia.ns.storage.cassandra.CassandraStorageService.<init>(CassandraStorageService.java:129)
    at
harpia.ns.storage.StorageServiceFactory.createInstance(StorageServiceFactory.java:39)
    at
harpia.ns.storage.StorageServiceFactory.createInstanceFor(StorageServiceFactory.java:29)
    at harpia.ns.NodeServer.<init>(NodeServer.java:82)
    at
harpia.ns.NodeServerFactory.createNodeServer(NodeServerFactory.java:8)
    at harpia.ns.StartNodeServer.run(StartNodeServer.java:56)

-----------------------------------------------------------------------------

Someone knows why the set variable disappear?
  initialized = true
in the class StorageService -> method initServer(int dalay)
in version 1.1.6, in this method it is set but in the version 1.2.0-beta2
it does not occour. So in my code I can not verify if the node is
initialized.

2012/11/28 aaron morton <aa...@thelastpickle.com>

> Do you have the error stack ?
>
> Cheers
>
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> New Zealand
>
> @aaronmorton
> http://www.thelastpickle.com
>
> On 28/11/2012, at 12:28 AM, Everton Lima <pe...@gmail.com> wrote:
>
> Hello people.
> I was using cassandra 1.1.6 and use the Object CassandraServer() to create
> keyspaces by my code.
>
> But when I update to version 1.2.0-beta2, my code starts to throw
> Exception (NullPointerException) in the method:
>
> *in version 1.1.6*
> CassandraServer -> state() ->
>  {
>        SocketAddress remoteSocket =
> SocketSessionManagementService.remoteSocket.get();
>        if (remoteSocket == null)
>            return clientState.get();
>
>        ClientState cState =
> SocketSessionManagementService.instance.get(remoteSocket);
>        if (cState == null)
>        {
>            cState = new ClientState();
>            SocketSessionManagementService.instance.put(remoteSocket,
> cState);
>        }
>        return cState;
>    }
>
> *in version 1.2.0*
> CassandraServer -> state() ->
> {
>       return ThriftSessionManager.instance.currentSession();
> }
> currtentSession(){
>          SocketAddress socket = remoteSocket.get();
>         assert socket != null;
>
>         ThriftClientState cState = activeSocketSessions.get(socket);
>         if (cState == null)
>         {
>             cState = new ThriftClientState();
>             activeSocketSessions.put(socket, cState);
>         }
>         return cState;
> }
>
>
> So, in version 1.1.6, it verify if has  a remote connection, it not it try
> to get o local. In the version 1.2.0 it try to get a remote connection and
> apply it
> to a ThriftClientState, but if does not have a remote connection (like in
> 1.1.6) it will throw a NullPointerException in line:
> ThriftClientState cState = activeSocketSessions.get(socket);
>
> Is any way to use CassandraServer in the new version??
>
> Thanks!
>
> --
>
> Everton Lima Aleixo
> Bacharel em Ciencia da Computação
> Universidade Federal de Goiás
>
>
>


-- 

Everton Lima Aleixo
Bacharel em Ciencia da Computação
Universidade Federal de Goiás

Re: Upgrade

Posted by aaron morton <aa...@thelastpickle.com>.
Do you have the error stack ? 

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 28/11/2012, at 12:28 AM, Everton Lima <pe...@gmail.com> wrote:

> Hello people.
> I was using cassandra 1.1.6 and use the Object CassandraServer() to create keyspaces by my code.
> 
> But when I update to version 1.2.0-beta2, my code starts to throw Exception (NullPointerException) in the method:
> 
> in version 1.1.6
> CassandraServer -> state() ->  
>  {
>        SocketAddress remoteSocket = SocketSessionManagementService.remoteSocket.get();
>        if (remoteSocket == null)
>            return clientState.get();
> 
>        ClientState cState = SocketSessionManagementService.instance.get(remoteSocket);
>        if (cState == null)
>        {
>            cState = new ClientState();
>            SocketSessionManagementService.instance.put(remoteSocket, cState);
>        }
>        return cState;
>    }
> 
> in version 1.2.0
> CassandraServer -> state() ->  
> { 
>       return ThriftSessionManager.instance.currentSession();
> }
> currtentSession(){
>          SocketAddress socket = remoteSocket.get();
>         assert socket != null;
> 
>         ThriftClientState cState = activeSocketSessions.get(socket);
>         if (cState == null)
>         {
>             cState = new ThriftClientState();
>             activeSocketSessions.put(socket, cState);
>         }
>         return cState;
> }
> 
> 
> So, in version 1.1.6, it verify if has  a remote connection, it not it try to get o local. In the version 1.2.0 it try to get a remote connection and apply it 
> to a ThriftClientState, but if does not have a remote connection (like in 1.1.6) it will throw a NullPointerException in line:
> ThriftClientState cState = activeSocketSessions.get(socket);
> 
> Is any way to use CassandraServer in the new version??
> 
> Thanks!
> 
> -- 
> 
> Everton Lima Aleixo
> Bacharel em Ciencia da Computação
> Universidade Federal de Goiás