[infinispan-issues] [JBoss JIRA] (ISPN-6408) ClassCastException while executed javascript returns Integer to js-client

Anna Manukyan (JIRA) issues at jboss.org
Fri Mar 18 13:15:02 EDT 2016


Anna Manukyan created ISPN-6408:
-----------------------------------

             Summary: ClassCastException while executed javascript returns Integer to js-client
                 Key: ISPN-6408
                 URL: https://issues.jboss.org/browse/ISPN-6408
             Project: Infinispan
          Issue Type: Bug
          Components: Remote Protocols
            Reporter: Anna Manukyan
            Assignee: Galder Zamarreño


In case if the javascript returns number, the execution of it over js-client, returns the following error:

{code}
Message:
     java.lang.ClassCastException: java.lang.Integer cannot be cast to [B
   Stacktrace:
     undefined

The code is: 

// mode=local,language=javascript,datatype='text/plain; charset=utf-8'
cache.size()

The verifying test is:
it('can execute a script remotely to get node address from cacheManager', function(done) {
    Promise.all([client, readFile('spec/utils/test-cacheManager.js')])
        .then(function(vals) {
          var c = vals[0];
          return c.addScript('test-cacheManager.js', vals[1].toString())
              .then(function() { return c; } );
        })
        .then(t.assert(t.exec('test-cacheManager.js'),
                       t.toBe(0)))
        .catch(failed(done)).finally(done);
  });
{code}

There is no exception on server side. Also please find below the log of the node.js execution:
{code}
[2016-03-18 18:10:53.848] [DEBUG] connection - Connecting to 127.0.0.1:11222
[2016-03-18 18:10:53.849] [DEBUG] connection - Connected to 127.0.0.1:11222
[2016-03-18 18:10:53.849] [DEBUG] client - Invoke ping(msgId=186)
[2016-03-18 18:10:53.849] [TRACE] encoder - Encode operation with topology id 0
[2016-03-18 18:10:53.849] [TRACE] transport - Write buffer(msgId=186) to 127.0.0.1:11222
[2016-03-18 18:10:53.852] [TRACE] decoder - Read header(msgId=186): opCode=24, status=6, hasNewTopology=0
[2016-03-18 18:10:53.852] [TRACE] decoder - Call decode for request(msgId=186)
[2016-03-18 18:10:53.852] [TRACE] connection - After decoding request(msgId=186), buffer size is 6, and offset 6
[2016-03-18 18:10:53.852] [TRACE] connection - Complete success for request(msgId=186) with undefined
[2016-03-18 18:10:53.852] [DEBUG] client - Invoke put(msgId=187,key=>test-cacheManager.js,value=>S// mode=local,language=javascript,datatype='text/plain; charset=utf-8'
cache.size(),opts=undefined)
[2016-03-18 18:10:53.853] [TRACE] encoder - Encode operation with topology id 0
[2016-03-18 18:10:53.853] [TRACE] transport - Write buffer(msgId=187) to 127.0.0.1:11222
[2016-03-18 18:10:53.854] [TRACE] decoder - Read header(msgId=187): opCode=2, status=6, hasNewTopology=0
[2016-03-18 18:10:53.854] [TRACE] decoder - Call decode for request(msgId=187)
[2016-03-18 18:10:53.854] [TRACE] connection - After decoding request(msgId=187), buffer size is 6, and offset 6
[2016-03-18 18:10:53.854] [TRACE] connection - Complete success for request(msgId=187) with undefined
[2016-03-18 18:10:53.854] [DEBUG] client - Invoke execute(msgId=188,scriptName=test-cacheManager.js,params=undefined)
[2016-03-18 18:10:53.855] [TRACE] encoder - Encode operation with topology id 0
[2016-03-18 18:10:53.855] [TRACE] transport - Write buffer(msgId=188) to 127.0.0.1:11222
[2016-03-18 18:10:53.855] [DEBUG] connection - Disconnected from 127.0.0.1:11222
[2016-03-18 18:10:53.858] [TRACE] decoder - Read header(msgId=188): opCode=80, status=133, hasNewTopology=0
[2016-03-18 18:10:53.858] [ERROR] decoder - Error decoding body of request(msgId=188): java.lang.ClassCastException: java.lang.Integer cannot be cast to [B
[2016-03-18 18:10:53.859] [TRACE] connection - After decoding request(msgId=188), buffer size is 75, and offset 75
[2016-03-18 18:10:53.859] [TRACE] connection - Complete failure for request(msgId=188) with java.lang.ClassCastException: java.lang.Integer cannot be cast to [B
[2016-03-18 18:10:53.869] [DEBUG] client - Invoke clear(msgId=189)
[2016-03-18 18:10:53.869] [TRACE] encoder - Encode operation with topology id 0
[2016-03-18 18:10:53.869] [TRACE] transport - Write buffer(msgId=189) to 127.0.0.1:11222
[2016-03-18 18:10:53.869] [TRACE] decoder - Read header(msgId=189): opCode=20, status=0, hasNewTopology=0
[2016-03-18 18:10:53.869] [TRACE] decoder - Call decode for request(msgId=189)
[2016-03-18 18:10:53.869] [TRACE] connection - After decoding request(msgId=189), buffer size is 6, and offset 6
[2016-03-18 18:10:53.869] [TRACE] connection - Complete success for request(msgId=189) with undefined
[2016-03-18 18:10:53.878] [DEBUG] connection - Disconnected from 127.0.0.1:11222
{code}



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the infinispan-issues mailing list