Home ResponseBuilder - Long cannot be cast to Collection?
Reply: 0

ResponseBuilder - Long cannot be cast to Collection?

user711 Published in July 19, 2018, 3:29 pm

I have this: Map<String, Object> social = new HashMap<String, Object>(); social.put("socialId", socialId); social.put("savedComment", savedComment);

and I'm trying to do this: builder = Response.status(Response.Status.OK).entity(social);

Why am I receiving HTTP Status 500 - java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Collection, since Object should work with Long and general Object classes? Can't I send two different types of data, so data contains data.socialId (as a Long) and data.savedComment (as an object)?

*By the way, socialId is a Long object, and savedComment is a SocialComment object.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.823344 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO