Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal

 
Kanwardeep Singh
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting a BigDecimal Through a getter method and putting that into a Map<String,Object[]>
that bigdecimal is part of the Object[] Array.
but i am getting this ClassCastException.

While fetching that array value and setting into Object[]
Map<String,Object[]> map=HashMap<String,Object[]>();
map.put("1",new Object[] { l_obj.getValueOfBigDecimal()})
I am getting this Execption.

Can anyBody help?
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show the full stacktrace please? That will give us a better idea as to where the problem is occurring. I suspect there is an issue with your get method.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you putting the BigDecimal object into the Object[] or into the Map?
 
Kanwardeep Singh
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes..i am putting BigDecimal into Object[] ar. and Object[] ar i am putting into Map.
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the exception would be thrown when you are getting the data out of the map, so why aren't we seeing that code? James Boswell asked you to post it quite a long time ago.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic