tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "braswell" <>
Subject ClassCastException after ant build in getting object from ServletContext
Date Mon, 01 Apr 2002 21:26:49 GMT
Been working on a connection pool to make is to we do not need to bounce
tomcat all the time.  Initially we had it setup so tomcat would start and
stop the connection pool when the server started.  I have created an admin
servlet that starts and stops
the connection pool the same way starting and stopping tomcat did it...

been getting a lot of class cast exceptions with the following call:
dbPoolConnServlet obj =(dbPoolConnServlet)

i know for a fact that context.getAttribute(dbPoolConnServlet.KEY) returns a
dbPoolConnServlet object because i have the following line of code before i
do the cast ( i print out the object id and number)

Object obja = context.getAttribute(dbPoolConnServlet.KEY);
System.out.println("obj " + obja);

obj dbPoolConnServlet@439a20

this indicates that obja is in-fact a dbPoolConnServlet and should cast
without a problem...

this is  a strange error since i have not changed any code in going from
tomcat starting the pool to this new servlet. I get this error after i do a
ant build.  IF i stop tomcat and restart --> then hit the servlet, there is
IF i then do an ant build --> then hit the servlet
 It only appears to be a problem if it has been loaded in memory
once.  After a build, i get this error everytime...

--error --

java.lang.ClassCastException: dbPoolConnServlet
        at tmplLogin.getConnectionPool_pcs(

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message