If a SFSB is looked up the server create a Instance of the bean and invoke the @PostConstruct method.
The first call of a business method throw an error EJBCLIENT000051 [1] and because of this the bean can never being removed.
The reason for this is that the SFSB does not have an interface marked as @Remote.
The client should throw an Exception during lookup and the server should not create an instance in that case.
[1]
INFO: Retrying invocation which failed on node home with exception: javax.ejb.NoSuchEJBException: No such EJB[appname=appclient,modulename=ejb,distinctname=,beanname=StatefulSessionBean,viewclassname=org.jboss.as.quickstarts.ejb.clients.server.app.StatefulSession]
at org.jboss.ejb.client.remoting.NoSuchEJBExceptionResponseHandler.processMessage(NoSuchEJBExceptionResponseHandler.java:64)
at org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver.handleMessage(ChannelAssociation.java:396)
at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:437)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000051: Cannot proceed with invocation since the locator StatefulEJBLocator{appName='appclient', moduleName='ejb', distinctName='', beanName='StatefulSessionBean', view='interface org.jboss.as.quickstarts.ejb.clients.server.app.StatefulSession', sessionId='
{[107, 42, -18, -55, -4, 38, 79, 88, -115, -123, -56, 69, 88, 73, 3, -76]}'} has an affinity on node home which has been excluded from current invocation context org.jboss.ejb.client.EJBClientInvocationContext@3456337e