3 Replies Latest reply on Oct 29, 2006 12:17 PM by wizzie

    JCA Adapter ClassCastException

    Elsa Conery Newbie


      I'm writing a JBoss JCA Adapter, and I have a strange ClassCastException in the client EJB code.

      Here's the situation (in the EJB)
      1. Look up JCA Connection via JNDI - OK.
      Object returned is a ConnectionFactory (store as connFact)
      2. Examine ConnectionFactory in debugger
      ConnectionFactory is really my own connection Factory implementation
      (let's call it FooConnectionFactory)
      in debugger, if I evaluate
      (connFact instanceof FooConnectionFactory)
      - answer is TRUE.
      3. I now cast connFact to type FooConnectionFactory.
      FooConnectionFactory myConnFact = (FooConnectionFactory)connFact;

      At this point, I get a ClassCastException!
      But this doesn't jive:
      - in the debugger, connFact is really a FooConnectionFactory.
      - casting *in the debugger* works too!

      Does anyone have any idea on what might be going wrong? An educated guess is some JBoss classloading issue - but it's just a guess.

      Any help is really appreciated.