-
1. Re: Remote stateless ejb proxy variable scope
wdfink Dec 27, 2013 4:11 AM (in response to marcio.dantas)There is no central documentation at the moment.
There are different approaches to connect EJB's.
What kind of proxy do you store? If you use injection there should be no problem with the application scope.
In general the Proxy has less functionality as in former releases. It will be just a simple implementation of the interface and it will not have connection informations.
The routing to the real instance is done during method invocation at server (or ejb-client) library.
-
2. Re: Remote stateless ejb proxy variable scope
marcio.dantas Dec 27, 2013 11:07 AM (in response to wdfink)I'm using the approach described here: EJB invocations from a remote server instance - JBoss AS 7.1 - Project Documentation Editor .
In my case the remote ejbs are stateless and the proxy is created and stored in a JSF application scoped managed bean.
I don't use CDI injection because I'm in a portlet environment.
Then, the remote ejb proxy gets injected in another beans (most of session beans), like in the code example below.
@ManagedBean(name = "remoteEjbProducerMB")
@ApplicationScoped
public class RemoteEjbProducerMB {
private RemoteInterfaceService remoteInterfaceService;
public RemoteInterfaceService getRemoteInterfaceService() {
if (remoteInterfaceService == null) {
remoteInterfaceService = remoteEjbServiceLocator .doJndiLookUp(RemoteInterfaceService.class);
}
return remoteInterfaceService;
}
}
@ManagedBean
@SessionScoped
public class SessionMB implements Serializable {
...
@ManagedProperty(value = "#{remoteEjbProducerMB.remoteInterfaceService}")
private transient RemoteInterfaceService remoteInterfaceService;
...
}