aspose file tools*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

class cast exception

Rafael Fagundes
Ranch Hand

Joined: Sep 23, 2004
Posts: 52
Hello!

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....

PS:
Browser feedback:

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

Servlet:

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

Thank�s for your attention,
Rafael.

Sorry for my bad english....


Thanks,
Rafa
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Well, something, somewhere in your web app is calling

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

directly or indirectly. Figure out where.


[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: class cast exception
 
Similar Threads
Problem with reading resource bundle
class cast exception
a simple quiz on string equals
I cannot understand what this error message trying to tell me?
why do i get TreeSet RuntimeException with my code?