Buggy code:
public class StatefulSessionComponent extends SessionBeanComponent implements IdentifierFactory < SessionID > , PassivationManager < SessionID , StatefulSessionComponentInstance > , StatefulObjectFactory < StatefulSessionComponentInstance > { private final Cache < SessionID , StatefulSessionComponentInstance > cache ; private final InterceptorFactory afterBegin ; private Interceptor afterBeginInterceptor ; private final Method afterBeginMethod ; private final InterceptorFactory afterCompletion ; private Interceptor afterCompletionInterceptor ; private final Method afterCompletionMethod ; private final InterceptorFactory beforeCompletion ; private Interceptor beforeCompletionInterceptor ; private final Method beforeCompletionMethod ; private final InterceptorFactory prePassivate ; private Interceptor prePassivateInterceptor ; private final InterceptorFactory postActivate ; private Interceptor postActivateInterceptor ; private final Map < EJBBusinessMethod , AccessTimeoutDetails > methodAccessTimeouts ; private final DefaultAccessTimeoutService defaultAccessTimeoutProvider ; private final ClassLoader loader ; private final int currentMarshallingVersion ; private final Map < Integer , MarshallingConfiguration > marshallingConfigurations ; private final InterceptorFactory ejb2XRemoveMethod ; private Interceptor ejb2XRemoveMethodInterceptor ; private final Set < Object > serialiableInterceptorContextKeys ; private final TimerService timerService ; protected StatefulSessionComponent ( final StatefulSessionComponentCreateService ejbComponentCreateService ) { } @ Override public StatefulSessionComponentInstance createInstance ( ) { } @ Override public StatefulSessionComponentInstance createInstance ( final Object instance ) { } @ Override protected StatefulSessionComponentInstance constructComponentInstance ( ManagedReference instance , boolean invokePostConstruct ) { } @ Override protected StatefulSessionComponentInstance constructComponentInstance ( ManagedReference instance , boolean invokePostConstruct , Map < Object , Object > context ) { } @ Override public void destroyInstance ( StatefulSessionComponentInstance instance ) { } @ Override public void postActivate ( StatefulSessionComponentInstance instance ) { } @ Override public void prePassivate ( StatefulSessionComponentInstance instance ) { } @ Override public ClassLoader getClassLoader ( ) { } @ Override public int getCurrentMarshallingVersion ( ) { } @ Override public MarshallingConfiguration getMarshallingConfiguration ( int version ) { } protected SessionID getSessionIdOf ( final InterceptorContext ctx ) { } @ Override public < T > T getBusinessObject ( Class < T > businessInterface , final InterceptorContext context ) throws IllegalStateException { } @ Override public EJBLocalObject getEJBLocalObject ( final InterceptorContext ctx ) throws IllegalStateException { } @ SuppressWarnings ( "unchecked" ) @ Override public EJBObject getEJBObject ( final InterceptorContext ctx ) throws IllegalStateException { if ( ( getEjbObjectViewServiceName ( ) ) == null ) { throw EjbMessages . MESSAGES . beanComponentMissingEjbObject ( getComponentName ( ) , "EJBObject" ) ; } final ServiceController < ? > serviceController = StatefulSessionComponent . currentServiceContainer ( ) . getRequiredService ( getEjbObjectViewServiceName ( ) ) ; final ComponentView view = ( ( ComponentView ) ( serviceController . getValue ( ) ) ) ; final String locatorAppName = ( ( getEarApplicationName ( ) ) == null ) ? "" : getEarApplicationName ( ) ; <START_BUG> return EJBClient . createProxy ( new org . jboss . ejb . client . StatefulEJBLocator < EJBObject > ( ( ( Class < EJBObject > ) ( view . getViewClass ( ) ) ) , locatorAppName , getModuleName ( ) , getComponentName ( ) , getDistinctName ( ) , getSessionIdOf ( ctx ) , this . getCache ( ) . getStrictAffinity ( ) ) ) ; <END_BUG> } @ Override public TimerService getTimerService ( ) throws IllegalStateException { } public AccessTimeoutDetails getAccessTimeout ( Method method ) { } public SessionID createSession ( ) { } public Cache < SessionID , StatefulSessionComponentInstance > getCache ( ) { } @ Override public SessionID createIdentifier ( ) { } @ Override protected BasicComponentInstance instantiateComponentInstance ( final Interceptor preDestroyInterceptor , final Map < Method , Interceptor > methodInterceptors , Map < Object , Object > context ) { } public void removeSession ( final SessionID sessionId ) { } public Interceptor getAfterBegin ( ) { } public Interceptor getAfterCompletion ( ) { } public Interceptor getBeforeCompletion ( ) { } public Method getAfterBeginMethod ( ) { } public Method getAfterCompletionMethod ( ) { } public Method getBeforeCompletionMethod ( ) { } public Interceptor getPrePassivate ( ) { } public Interceptor getPostActivate ( ) { } public Interceptor getEjb2XRemoveMethod ( ) { } @ Override public void start ( ) { } @ Override protected void createInterceptors ( InterceptorFactoryContext context ) { } @ Override public void stop ( ) { } @ Override public AllowedMethodsInformation getAllowedMethodsInformation ( ) { } public Set < Object > getSerialiableInterceptorContextKeys ( ) { } private static ServiceContainer currentServiceContainer ( ) { } }

Fix:
return EJBClient . createProxy ( new org . jboss . ejb . client . StatefulEJBLocator < EJBObject > ( ( ( Class < EJBObject > ) ( view . getViewClass ( ) ) ) , locatorAppName , getModuleName ( ) , getComponentName ( ) , getDistinctName ( ) , getSessionIdOf ( ctx ) , this . getCache ( ) . getStrictAffinity ( ) , null ) ) ;