10.7. Testing messaging EJBs

Message-driven EJBs need test clients, just as other EJBs do. With message-driven EJBs, the test client will be a program that produces messages to the queue to which the EJB is listening. It is not possible for a client to call the EJB’s onMessage() method directly.

Hint

Because a message-driven EJB does not have a ‘caller’ in the usual sense, the developer must assign a security role to the onMessage() method, as the container can’t determine it from the caller. In practice, you may not be ready to assign security roles when initially testing EJBs. The J2EE Reference Implementation server will operate a message-driven EJB with an empty security role for its onMessage() method, despite complaints from the verifier. ...

Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.