• Post Reply Bookmark Topic Watch Topic
  • New Topic

Classcast exception in jsp

 
Siddalinga Murthy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,
I am doing the following in a jsp.I am storing a connection pool in the servletcontext and taking it back if its already initiated.
But when i restart the server it works When i make any changes in the jsp like commenting also This is throwing up the exception classcastException.
Can anybody help me out in this matter
This is happening in bea weblogic5.1
ConnectionPool OurConnectionPool=new ConnectionPool();
Object objConnServlet=getServletConfig().getServletContext().getAttribute("abc");

if (objConnServlet==null)
{
ourConnectionPool.initialize();
getServletConfig().getServletContext().setAttribute("abc",ourConnectionPool);
}
else
{
ourConnectionPool=(ConnectionPool)objConnServlet;
}
 
shilpa kulkarni
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
log the reference 'objConnServlet' and see what class type it is. you will find that it is not of type 'ConnectionPool', and hence throws ClassCastException. can u try this and tell what type it prints.
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
Here's some Weblogic documentation on the subject.
Hope that helps,
http://edocs.bea.com/wls/docs61/jdbc/programming.html#1031551
------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!