Re: Casting an action to an interface

2009-01-30 Thread Nils-Helge Garli Hegvik
Have you tried using reflection to dump all the interfaces (and corresponding classloaders) the action implements? Obviously, this shouldn't be possible under normal circumstances... Or if you're using maven 2, try running the app with the maven jetty plugin (or if you're not, deploy to a differen

Re: Casting an action to an interface

2009-01-30 Thread Andy Sykes
I'd love to zip up the whole project and stick it somewhere but it's pretty dependent on the environment I'm running it in (LDAP server for auth, etc etc). I could probably produce a neutered version of it that'll run anywhere, but it'll take a while as it's quite big.. As for classloaders,

Re: Casting an action to an interface

2009-01-30 Thread Dave Newton
If you have a small project you could host somewhere that might help, or just zip up all the source. Clearly this can't happen (ignoring for the moment that it is), but the framework obviously relies on this working so I'd have to assume something funky is going on. Dave Andy Sykes wrote: I d

Re: Casting an action to an interface

2009-01-30 Thread Musachy Barroso
I am putting my money on different class loaders. That is easy to test, get the class loader from your action, and the class loader from the current class (interceptor or whatever) and see if their object id is the same. musachy On Fri, Jan 30, 2009 at 8:13 AM, Andy Sykes wrote: > I dug around i

Re: Casting an action to an interface

2009-01-30 Thread Andy Sykes
I dug around in the ServletConfig interceptor and modified my code to mimic how it handles this situation - retrieve the Action as an Object type, test for instanceof , the cast to it. For some reason, that still does not work. As a test case, I'm mimicking the code exactly. My action exte

Re: Casting an action to an interface

2009-01-30 Thread Andy Sykes
No, I don't 'need' the cast to Action. However, if I cast what I get back from ActionInvocation.getAction() straight to SessionAware or similar, it still chucks a CCE. I'm using Netbeans, and I'm pretty sure there's no crazy stuff going on with the classloader - all my struts jars are in my

Re: Casting an action to an interface

2009-01-30 Thread Nils-Helge Garli Hegvik
Do you really need the first cast to Action? Anyway, could it be that you're having conflicting struts and/or application jars several places in your classloader hierarchy? That could explain certain "should never happen" incidents... Nils-H On Fri, Jan 30, 2009 at 12:39 PM, Andy Sykes wrote: >

Re: Casting an action to an interface

2009-01-30 Thread Andy Sykes
Hi Wes, No, I'm not using Spring at all. The Action never passes the test of being an instanceof Parseable. If I make the action only implement SessionAware, and test if my action is an instanceof SessionAware, the test is never passed! Colour me confused! Andy. On 30 Jan 2009, at 00:55

Re: Casting an action to an interface

2009-01-29 Thread Wes Wannemacher
On Thursday 29 January 2009 19:49:39 Andy Sykes wrote: > Hi all, > > I've written an interceptor with a PreResultListener that gets the > action with ActionInvocation.getAction(), then casts it to an > interface ("Parseable", in this case). This lets me call a particular > method on the action just

Casting an action to an interface

2009-01-29 Thread Andy Sykes
Hi all, I've written an interceptor with a PreResultListener that gets the action with ActionInvocation.getAction(), then casts it to an interface ("Parseable", in this case). This lets me call a particular method on the action just prior to the result being rendered. The action implement