ClassCastException after republishing

smartr <[email protected]> Sat, 16 Dec 2006 03:07:27 CST
Newsgroups gmane.comp.java.open-symphony.webwork
Message-ID <19729039.1166260077776.JavaMail.os-j2ee@opensymphony01.managed.contegix.com>
I'm not absolutely sure this is a WebWorks related, but I x-posted this to the tomcat forums, and was wondering if any of you could help me figure out how to fix this, or perhaps point me to a better way of handling the issue through WW.

....
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.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53867&messageID=108132#108132

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]