ClassCastException when retrieving the result of an asynchronous EJB method execution in EAP 6

Solution In Progress - Updated -

Issue

We have an EJB in an EAR that uses asynchronous methods and it is consumed by another WAR deployment:

@EJB(lookup="java:global/testejb/testejb-ejb/AsyncService!rh.test.AsyncEJB")
private AsyncEJB asyncEJB;

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Future<ReturnObject> futro = asyncEJB.testAsync();
        ReturnObject ro; 
        try {
                // this line throws the CCE
                ro = futro.get();
        }   
        catch (InterruptedException e) {
                printResponse(resp, e.getMessage());
                return;
        }   
        catch (ExecutionException e) {
                printResponse(resp, e.getMessage());
                return;
        }
}

When trying to retrieve the EJB invocation using Future.get, we have ClassCastException error:

JBWEB000236: Servlet.service() for servlet rh.test.AsyncServlet threw exception: java.lang.ClassCastException: rh.test.ReturnObject cannot be cast to rh.test.ReturnObject

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

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.