This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Java in General and the fly likes class cast exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

class cast exception

Rafael Fagundes
Ranch Hand

Joined: Sep 23, 2004
Posts: 52

Well, in a jsp system I'm getting java.lang.ClassCastException: java.lang.String error when trying to access a page. It�s strange because when i visit this page for the first time nothing happens. But if i navigate for while and redirect to "the page", this error occurs.

A time this error appeared when i created a session variable two times, with different names....

Browser feedback:

java.lang.ClassCastException: java.lang.String
at org.apache.jsp.ConsultaSolicitacoes_jsp._jspService(


ns = (YYY.NucleoSolucionador) _jspx_page_context.getAttribute("ns", PageContext.SESSION_SCOPE);

Thank�s for your attention,

Sorry for my bad english....

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24193

Well, something, somewhere in your web app is calling

pageContext.setAttribute("ns", "a string.");

directly or indirectly. Figure out where.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: class cast exception
It's not a secret anymore!