Error retrieving message

Kate, previously server code library wasn’t up to date, so I downloaded latest server code and iOS SDK.
Other problems are gone except for getting below message when retrieving message.

FYI, I do not run any server code for messaging.

Error receiving messages [Server.Processing] java.lang.RuntimeException: java.lang.ClassCastException: com.backendless.services.messaging.BackendlessSubscriber cannot be cast to java.util.HashMap

API used for retrieving message is the following.
-(void)subscribe:(NSString *)channelName subscriptionResponse:(void(^)(NSArray *))subscriptionResponseBlock subscriptionError:(void(^)(Fault *))subscriptionErrorBlock subscriptionOptions:(SubscriptionOptions *)subscriptionOptions response:(void(^)(BESubscription *))responseBlock error:(void(^)(Fault *))errorBlock;

Thanks.

Scott,

Just to confirm: does the error you reported occur when you make the following call?

-(void)subscribe:(NSString *)channelName subscriptionResponse:(void(^)(NSArray *))subscriptionResponseBlock subscriptionError:(void(^)(Fault *))subscriptionErrorBlock subscriptionOptions:(SubscriptionOptions *)subscriptionOptions response:(void(^)(BESubscription *))responseBlock error:(void(^)(Fault *))errorBlock;

Regards,
Mark

Hi Mark, yes that is one.

Hi Scott,

Could you please describe (of show the code) what you’re sending in the subscriptionOptions argument?

Regards,
Mark

Hi Mark,
Code is following
_subscriptionOptions = [SubscriptionOptions new];

As you know I had this code for while, and never changed.

Regards,
Scott

Any updates?

BTW, my custom code fails now.

We’re still investigating the problem with the subscription call.

What error do you get with custom code?

It looks like all the custom codes are failing.On my client app error message I get is belowDomain=NSURLErrorDomain Code=-1001 “The request timed out.”
on the server, developer’s log, I see some casting exception like below.

7/27/15 3:24 PM ERROR com.backendless.bzzle.events.custom_events.SendTextAsyncEventHandler Messaging.publish BackendlessException{ code: ‘Server.Processing’, message: ‘java.lang.RuntimeException: java.lang.ClassCastException’ }

I am confused. In your very first post in this thread you said:

FYI, I do not run any server code for messaging.

Now you’re reporting a problem from server-side code. Please clarify.

I meant that I am not using GenericChannelEventHandler.

The messaging that is printed is from custom server code, I use custom server code to push message using below api, which I had it for long time, didn’t have problem.

Backendless.Messaging.publish(…)

When I created this issue, I wasn’t calling this custom code(messaging), but kept getting “cannot be cast to java.util.HashMap” when after subscribing with below API.

-(void)subscribe:(NSString *)channelName subscriptionResponse:(void(^)(NSArray *))subscriptionResponseBlock subscriptionError:(void(^)(Fault *))subscriptionErrorBlock subscriptionOptions:(SubscriptionOptions *)subscriptionOptions response:(void(^)(BESubscription *))responseBlock error:(void(^)(Fault *))errorBlock;

The reason I mention that I don’t use messaging is because previously, I had problems from having afterPoll, which I removed.

Hi Scott!
As the result we have 2 issues:
1st: after subscribing with ios sdk you receive “cannot be cast to java.util.HashMap”.
Do you receive this error always or in some special cases?

2nd: you have custom event handler with Backendless.Messaging.publish(…) code. It worked previously and stopped working yesterday?
I understood you correctly?
Please provide handler code and way how you invoke it.
Regards,
Kate.

Hi Kate,

  1. Subscribe issue
    Do you receive this error always or in some special cases?

I receive the error all the time, there’s nothing special with my code. It is easy to reproduce, from code gen sample chat, just change the subscribe part to below api, and you will receive error message “cannot be cast to …” in “subscriptionError:(void(^)(Fault *))subscriptionErrorBlock” every polling period (1 second).

-(void)subscribe:(NSString *)channelName subscriptionResponse:(void(^)(NSArray *))subscriptionResponseBlock subscriptionError:(void(^)(Fault *))subscriptionErrorBlock subscriptionOptions:(SubscriptionOptions *)subscriptionOptions response:(void(^)(BESubscription *))responseBlock error:(void(^)(Fault *))errorBlock;

  1. server code timeout
    What happened is that I was debugging server code(didn’t set break point though), and console started to show errors, and calling custom server code responded with time out until today. The below is log from console from application.log file.

2015-07-27 16:03:09,074 [INFO] Runner successfully registered
2015-07-27 16:03:09,075 [INFO] Parsing event model…
2015-07-27 16:03:09,188 [INFO] Build successfully: EventModel{timers=0, eventHandlers=10}
2015-07-27 16:03:09,188 [INFO] Deploying model to server, and starting debug…
2015-07-27 16:03:10,828 [INFO] Model successfully deployed…
2015-07-27 16:03:10,828 [INFO] Waiting for events…
2015-07-27 16:17:15,438 [ERROR] Connection issue
redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream.
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:207) ~[CodeRunner.jar:na]
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:47) ~[CodeRunner.jar:na]
at redis.clients.jedis.Protocol.process(Protocol.java:131) ~[CodeRunner.jar:na]
at redis.clients.jedis.Protocol.read(Protocol.java:196) ~[CodeRunner.jar:na]
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:283) ~[CodeRunner.jar:na]
at redis.clients.jedis.Connection.getIntegerReply(Connection.java:208) ~[CodeRunner.jar:na]
at redis.clients.jedis.BinaryJedis.rpush(BinaryJedis.java:1015) ~[CodeRunner.jar:na]
at com.backendless.coderunner.processor.ResponderProcessor.run(ResponderProcessor.java:49) ~[CodeRunner.jar:na]

  1. message publishing error log
    I use message publish in server code “SendTextAsyncEvent”.
    Calling this server code, I see some error logs from server code developer log file. It looks like your code has some casting problem which looks similar to “subscribe issue”.
    Although it threw below error from my server code, push is sent/received and message is seen from console messaging. Sometimes push is sent twice though.

The code that prints below message is, I have

try {

MessageStatus ms = Backendless.Messaging.publish(rid, text, publishOptions, deliveryOptions);
} catch (BackendlessException ex) {

log.error("Messaging.publish " + ex); => printed to log

		}

7/25/15 4:32 PM ERROR com.backendless.bzzle.events.custom_events.SendTextAsyncEventHandler Messaging.publish BackendlessException{ code: ‘Server.Processing’, message: ‘java.lang.RuntimeException: java.lang.ClassCastException: com.backendless.services.messaging.BackendlessSubscriber cannot be cast to java.util.HashMap’ }
7/27/15 3:24 PM ERROR com.backendless.bzzle.events.custom_events.SendTextAsyncEventHandler 7/28/15 8:11 AM ERROR com.backendless.bzzle.events.custom_events.SendTextAsyncEventHandler Messaging.publish BackendlessException{ code: ‘Server.Processing’, message: ‘java.lang.RuntimeException: java.lang.ClassCastException’ }

Regards,
Scott

  1. “server code timeout (2)” application sends when you have connection problems (lost internet connection for example)
  2. Could you provide your application id?

Scott,
please check again third issue.
It should work.

  1. Well, it was “casting” problem not timeout.
    The problem appears to be gone now.

  2. I will email you app id

  3. Error log is still printed. I will check again in an hour and let you know.