ClassCastException on EJB getList between EARs

Solution In Progress - Updated -

Issue

  • Why does a remote ejb fail with ClassCastException, in a call between ears, one ear gets to see the other ear's class loader? The interface of the class is in a static module. SomeBaseType is declared in a static module known by both EARs.

    interface Bean2Interface{
      List<? extends SomeBaseType>returnAs()
    }
    
    class A extends SomeBaseType{
      ....
    }
    
    Bean2Interface bean2 = lookup.....//does a lookup on the remote interface to EAR2
    List<A> retrievedAs = bean2.retrieveAs(); //this is working
    A a = retrievedAs.get(0); // this gives ClassCastException
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.0.7
  • Two Ears and a static module with the interface of the class.

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.