1 Reply Latest reply on Jul 26, 2006 12:28 PM by cuoz

    ClassCastException calling EJB3 from Portal

      Hi all,
      I'm trying to use my EJB3 application from a JBoss Portal portlet and getting the infamous ClassCastException. I have read all the wiki & other resources on classloading, etc, but have not been able to solve this one.

      Specifics are: JBoss 4.0.4GA, Portal 2.4-CR2, EJB3 RC7 (I just noticed RC8 was released last week, so haven't tried it yet).

      I have packaged the ejb3 application and the portlet application in separate ear files, and have also tried scoped loader repositories. The portlet includes a jar file of only the client parts of my ejb3 application. I have JBossAS configured for call by value, etc.

      Here are application specifics:
      ClientEJB is an entity that implements Client interface
      ClientSessionBean is a SLSB
      ClientSessionLocal is the local interface to the session bean
      The method I am calling on the session bean is:
      Client createClient(String username, String password)

      It creates an instance of ClientEJB, persists it, and returns it as a Client interface.

      The call to the session bean works fine. I get the CCE when I try to use the returned object as a Client and not a ClientEJB.

      What should I be doing to make this work? I'm sure if I package it all in the same ear file it will work, but I don't want that (though I haven't tried that yet).

      Hopefully somebody already ran into this scenario and can help. Let me know if you need more information.

      Thank you in advance,
      Gary.

        • 1. Re: ClassCastException calling EJB3 from Portal

          Ok, I made a plain old WAR file (not a portlet) and deployed a simple JSP that uses my session bean just fine with the exact code copy/pasted from my portlet. So, it is probably a portal issue and not a EJB3 issue.

          I'll take my issue over to the portal forum and sorry for the wasted bandwidth.

          Gary.