Can using @EJB work even if the EJB interface is not denoted with @Remote or @Local annotation?

Solution In Progress - Updated -

Issue

  • The following EJB declaration :
@Stateless
public class StandardHelloImpl implements HelloService {

    @Override
    public String getHelloMessage() {
        return "Hello New Customer";
    }

}
The interface is:
public interface HelloService {
    String getHelloMessage();
}

does not have @Remote or @Local marked on the interface. Can this setup work when using @EJB to setup a reference when calling EJB's?

Environment

  • Yes. This will work. Since in the above example,"HelloService" is the only implemented interface of the EJB, the container assumes that it must be a local business interface.

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content