• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.Lang.classCastException

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am trying to store the string list in and object array but I am getting classCastException on it. Can anyone help me on that?
I am using JDK1.5.

Here is the code:



The statusResoultList has data in it hence for loop is getting called but at the ddeclaration part of statusRow I am gettign the exception.
Please help me as soon as possible!!
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No idea why you get a ClassCastException, we don't know what's in statusQueryResults. In fact, we don't even know its actual type. I'm guessing it's List<Object[]>.

Can you show us the pieces of code where you add data to it?

Please help me as soon as possible!!


http://faq.javaranch.com/java/EaseUp
 
Aalok Mishra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

First Thing, sorry for the asap part.I'll take care abt it in furture.

Now, to anwer your question,sure I can. Here is the piece of code that is populating data in the statusQueryResult.



This code return all the columns in the table for the week id provied. The status QueryResults is gettign populatedd correctly as I have debugged it till taht point. But I ma not able to debug this calssCastException.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aalok

Looking at your code I can't see anything in particular that would be causing a class cast exception.
Could you please check the stack trace to find out which line number the error was flagged on, and then double check that it does fall on the line you think it does (I assum you think this is 'Object[] statusRow...').
Also was there any reason you included 'statusResultList' at the beginning of your first code snippet? The reason I ask is that doesn't get used anywhere so wondered why it had been included


 
reply
    Bookmark Topic Watch Topic
  • New Topic