Hi!
I get
"Failed to find SFSB instance with session ID ... in cache"
message on every call to stateful session bean's remove() method ("EJB2.* style").
My investigation of source code has shown that JBoss adds remove interceptors for the remove() method twice:
first it adds a StatefulRemoveInterceptor from StatefulSessionComponentCreateService:
//the interceptor chain for EJB e.x remove methods
this.ejb2XRemoveMethod = Interceptors.getChainedInterceptorFactory(StatefulSessionSynchronizationInterceptor.factory(componentDescription.getTransactionManagementType()), new ImmediateInterceptorFactory(new StatefulRemoveInterceptor(false)), Interceptors.getTerminalInterceptorFactory());
then it adds StatefulRemoveDelegationInterceptor from StatefulSessionBeanObjectViewConfigurator.handleRemoveMethod():
configuration.addViewInterceptor(method, StatefulRemoveDelegationInterceptor.FACTORY, InterceptorOrder.View.COMPONENT_DISPATCHER);
Then during processing of call to remove() first StatefulRemoveInterceptor calls NonPassivatingBackingCacheImpl.remove(), then StatefulRemoveDelegationInterceptor calls NonPassivatingBackingCacheImpl.release(), which leads to EjbLogger.ROOT_LOGGER.cacheEntryNotFound(key) which in turn produces the aforementioned error message.