I have a custom class, TableHierarchy, I am instantiating in the
contextInitialized function in the ServletContextListener class. The class
is placed as a value in a map:
Map<String, TableHierarchy> tableSet = new ConcurrentHashMap<String,
TableHierarchy>();
I then place the map into the ServletContext:
context.setAttribute("foo.security.Hierarchy", tableSet);
I'm using WebWorks, and so in a session aware action, I retrieve this
object:
ConcurrentHashMap<String,TableHierarchy> heirarchy =
(ConcurrentHashMap<String,TableHierarchy>)context.getAttribute("
foo.security.Hierarchy");
I then retrieve the TableHierarchy:
TableHierarchy foobaz = heirarchy.get("EMPLOYEE");
...
This works fine when I start the server from scratch, but when I change one
of my actions, and the server republishes itself, whenever it gets to this
call, it throws a *java.lang.ClassCastException: foo.TableHierarchy
*So, to get a bit clearer idea what was going on, I replaced the last line
with:
Object foo = heirarchy.get("EMPLOYEE");
Class bar = foo.getClass();
String baz = bar.toString();
String foobar = ((foo.TableHierarchy)foo).primaryKey;

This of course threw the CCException at the last line, but it did allow me
to see that the object did retain the TableHierarchy class type... So I
imagine this is class path issue. I admit this is potentially more related
to how webworks is loading things, but this is running on Tomcat 5.5, and
don't really know where to go from here with the bug (as it would be nice to
be able to update the application on the fly). Any help would be
appreciated.

Reply via email to