1 Reply Latest reply on Apr 3, 2014 5:34 AM by jaikiran

    Remote EJB security - JAAS

    jester_racer

      Hi!

       

      We have some problem setting up remote EJB calls with JAAS security. We have 2 separate Jboss instances, say "Server A" and "Server B".

      There is a web application deployed on "Server A", on which the user can log in using a login form, using JAAS.

      On "Server B" there is a simple war deployed containing only 1 remote EJB.

      When the user logs in to "Server A" there is a local EJB that automatically calls the remote EJB on "Server B".

       

      The problem is that I have to know the logged in username on "Server B" in the remote EJB, so I decided to setup the server to use EJB security, to be able to automatically propagate the user principal to the server running the remote EJB.

       

      Server A

       

      standalone.xml changes

      <!-- security realm for ejb security -->
      <security-realm name="ejb-security-realm">
         <authentication>
            <jaas name="other" />
         </authentication>
      </security-realm>
      
      <!-- ... -->
      
      <!-- remoting subsystem using the ejb-security-realm -->
              <subsystem xmlns="urn:jboss:domain:remoting:1.1">
                  <connector name="remoting-connector" socket-binding="remoting" security-realm="ejb-security-realm"/>
                  <outbound-connections>
                      <remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="remote-ejb" security-realm="ejb-security-realm">
                          <properties>
                              <property name="SASL_POLICY_NOANONYMOUS" value="false"/>
                              <property name="SSL_ENABLED" value="false"/>
                          </properties>
                      </remote-outbound-connection>
                  </outbound-connections>
              </subsystem>
      
      <!-- ... -->
      
      <!-- Custom security domain -->
                       <security-domain name="other" cache-type="default">
                          <authentication>
                              <login-module code="Remoting" flag="optional">
                                  <module-option name="password-stacking" value="useFirstPass"/>
                              </login-module>
                              <login-module code="RealmDirect" flag="required">
                                  <module-option name="password-stacking" value="useFirstPass"/>
                              </login-module>
                              <login-module code="RealmUsersRoles" flag="required">
                                  <module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
                                  <module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
                                  <module-option name="realm" value="ApplicationRealm"/>
                                  <module-option name="password-stacking" value="useFirstPass"/>
                              </login-module>
                          </authentication>
                      </security-domain>
      
      <!-- ... -->
      
      <!-- Socket binding for remoting -->
              <outbound-socket-binding name="remote-ejb">
                  <remote-destination host="localhost" port="4447"/>
              </outbound-socket-binding>
      
      

       

      jboss-ejb-client.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-ejb-client xmlns="urn:jboss:ejb-client:1.0">
          <client-context>
              <ejb-receivers exclude-local-receiver="true">
                  <remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection"/>
              </ejb-receivers>
          </client-context>
      </jboss-ejb-client>
      
      

       

      jboss-web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-web PUBLIC
          "-//JBoss//DTD Web Application 2.4//EN"
          "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
      <jboss-web>
          <security-domain>other</security-domain>
      </jboss-web>
      
      

       

      web.xml

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee"
          xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
          version="2.5">
          <display-name>Example App</display-name>
          <session-config>
              <session-timeout>60</session-timeout>
          </session-config>
          <welcome-file-list>
              <welcome-file>auth/index.html</welcome-file>
          </welcome-file-list>
      
      
          <login-config>
              <auth-method>FORM</auth-method>
              <realm-name>ApplicationRealm</realm-name>
              <form-login-config>
                  <form-login-page>/login.html</form-login-page>
                  <form-error-page>/login.html</form-error-page>
              </form-login-config>
          </login-config>
      
      
          <security-constraint>
              <web-resource-collection>
                  <web-resource-name>Secured Content</web-resource-name>
                  <url-pattern>/auth/*</url-pattern>
                  <http-method>GET</http-method>
                  <http-method>POST</http-method>
              </web-resource-collection>
              <auth-constraint>
                  <role-name>ADMINISTRATOR</role-name>
                  <role-name>AUTHENTICATED</role-name>
              </auth-constraint>
          </security-constraint>
      
      
          <security-role>
              <role-name>ADMINISTRATOR</role-name>
          </security-role>
          <security-role>
              <role-name>AUTHENTICATED</role-name>
          </security-role>
      </web-app>
      
      

       

      Local EJB calling the remote ejb

      @Local
      @Stateless
      public class TestLocalEjbImpl implements TestLocalEjb {
      
      
          @EJB(mappedName = "ejb:/security-remote/master/TestRemoteEjbImpl!hu.commitment.pilot.security.common.TestRemoteEjb")
          private TestRemoteEjb remoteEJB;
      
      
          @Override
          public void callRemoteEJB() {
              remoteEJB.dummyCall();
          }
      }
      
      
      
      
      
      
      

       

      login.html

      <!DOCTYPE HTML>
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>Login</title>
      </head>
      
      
      <body>
          <div id="contentWrapper">
              <div id="header"></div>
              <div id="content">
                  <form id="loginForm" action="j_security_check" method="post">
                      <input type="text" name="j_username" value="nagyf" maxlength="22" /> <input type="password"
                          name="j_password" value="asd_qwe123" maxlength="22" /> <input type="submit" />
                  </form>
              </div>
              <div id="footer"></div>
          </div>
      </body>
      </html>
      
      
      
      

       

      Server B

       

      standalone.xml changes (I don't know which one of these are needed )

      <security-domain name="other" cache-type="default">
                          <authentication>
                              <login-module code="Remoting" flag="optional">
                                  <module-option name="password-stacking" value="useFirstPass"/>
                              </login-module>
                              <login-module code="RealmDirect" flag="required">
                                  <module-option name="password-stacking" value="useFirstPass"/>
                              </login-module>
                              <login-module code="RealmUsersRoles" flag="required">
                                  <module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
                                  <module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
                                  <module-option name="realm" value="ApplicationRealm"/>
                                  <module-option name="password-stacking" value="useFirstPass"/>
                              </login-module>
                          </authentication>
                      </security-domain>
      
      

       

      jboss-ejb3.xml

      <?xml version="1.0" encoding="UTF-8"?> 
      <jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"  
          xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
          xmlns:security="urn:security" version="3.1" impl-version="2.0"> 
          <assembly-descriptor xmlns="http://java.sun.com/xml/ns/javaee">  
              <security:security xmlns:security="urn:security"> 
                  <security:security-domain>other</security:security-domain> 
                  <ejb-name>*</ejb-name> 
              </security:security> 
          </assembly-descriptor> 
      </jboss:ejb-jar> 
      
      

       

      jboss-web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-web>
          <distinct-name>master</distinct-name>
      </jboss-web>
      
      

       

      Remote EJB

      @Stateless
      SecurityDomain("other")
      public class TestRemoteEjbImpl implements TestRemoteEjb {
      
      
          private static final Logger LOG = LoggerFactory
                                                  .getLogger(TestRemoteEjbImpl.class);
      
      
          @Resource
          private EJBContext          ejbContext;
      
      
          @Resource
          private SessionContext      sessionContext;
      
      
          @Override
          @PermitAll
          public void dummyCall() {
              final String userName = ejbContext.getCallerPrincipal() != null ? ejbContext
                      .getCallerPrincipal().getName() : null;
      
      
              TestRemoteEjbImpl.LOG.info(String.format(
                      "Remote ejb called by user: %s!", userName != null ? userName
                              : "anonymous"));
          }
      }
      
      
      
      
      
      
      
      
      
      
      
      

       

       

      Error

       

      The error message I get when I try to call the remote EJB:

      11:04:38,040 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.1.0.Alpha1 (AS 7.2.0.Alpha1-redhat-4) started in 10029ms - Started 184 of 243 services (58 services are passive or on-demand)
      11:04:50,642 ERROR [org.jboss.remoting.remote.connection] (Remoting "tgrcompc004" read-1) JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Cannot get userid/password [Caused by javax.security.auth.callback.UnsupportedCallbackException]
      11:04:50,644 DEBUG [org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService] (ejb-client-remote-connection-reconnect-3-thread-1) Reconnect attempt#1 failed for outbound connection service jboss.remoting.endpoint.subsystem.outbound-connection.remote-ejb-connection: java.lang.RuntimeException: javax.security.sasl.SaslException: Cannot get userid/password [Caused by javax.security.auth.callback.UnsupportedCallbackException]
        at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:91) [jboss-ejb-client-1.0.16.Final.jar:1.0.16.Final]
        at org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService$OutboundConnectionReconnectHandler.reconnect(DescriptorBasedEJBClientContextService.java:219) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.ejb.client.EJBClientContext$ReconnectAttempt.run(EJBClientContext.java:1186) [jboss-ejb-client-1.0.16.Final.jar:1.0.16.Final]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_09]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_09]
        at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_09]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09]
      Caused by: javax.security.sasl.SaslException: Cannot get userid/password [Caused by javax.security.auth.callback.UnsupportedCallbackException]
        at com.sun.security.sasl.ClientFactoryImpl.getUserInfo(ClientFactoryImpl.java:157) [rt.jar:1.7.0_09]
        at com.sun.security.sasl.ClientFactoryImpl.createSaslClient(ClientFactoryImpl.java:94) [rt.jar:1.7.0_09]
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities$1.run(ClientConnectionOpenListener.java:369)
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities$1.run(ClientConnectionOpenListener.java:367)
        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_09]
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:367)
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:225)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
        at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
        at org.xnio.ssl.JsseConnectedSslStreamChannel.handleReadable(JsseConnectedSslStreamChannel.java:180)
        at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.nio.NioHandle.run(NioHandle.java:90)
        at org.xnio.nio.WorkerThread.run(WorkerThread.java:187)
        at ...asynchronous invocation...(Unknown Source)
        at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:270)
        at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251)
        at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349)
        at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:337)
        at org.jboss.as.remoting.RemoteOutboundConnectionService.connect(RemoteOutboundConnectionService.java:109)
        at org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService$OutboundConnectionReconnectHandler.reconnect(DescriptorBasedEJBClientContextService.java:218) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        ... 7 more
      Caused by: javax.security.auth.callback.UnsupportedCallbackException
        at org.jboss.as.remoting.AbstractOutboundConnectionService$AnonymousCallbackHandler.handle(AbstractOutboundConnectionService.java:103)
        at com.sun.security.sasl.ClientFactoryImpl.getUserInfo(ClientFactoryImpl.java:136) [rt.jar:1.7.0_09]
        at com.sun.security.sasl.ClientFactoryImpl.createSaslClient(ClientFactoryImpl.java:94) [rt.jar:1.7.0_09]
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities$1.run(ClientConnectionOpenListener.java:369)
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities$1.run(ClientConnectionOpenListener.java:367)
        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_09]
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:367)
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:225)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
        at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
        at org.xnio.ssl.JsseConnectedSslStreamChannel.handleReadable(JsseConnectedSslStreamChannel.java:180)
        at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.nio.NioHandle.run(NioHandle.java:90)
        at org.xnio.nio.WorkerThread.run(WorkerThread.java:187)
      
      
      11:04:50,778 ERROR [org.jboss.as.ejb3.invocation] (http-localhost/127.0.0.1:8180-1) JBAS014134: EJB Invocation failed on component TestLocalEjbImpl for method public abstract void hu.commitment.pilot.ejb.TestLocalEjb.callRemoteEJB(): javax.ejb.EJBException: java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:security-remote, distinctName:master] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@606f970e
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:165) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:250) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:315) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:214) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at hu.commitment.pilot.ejb.TestLocalEjb$$$view1.callRemoteEJB(Unknown Source) [classes:]
        at hu.commitment.pilot.web.TestServlet.doGet(TestServlet.java:33) [classes:]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09]
      Caused by: java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:security-remote, distinctName:master] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@606f970e
        at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:693) [jboss-ejb-client-1.0.16.Final.jar:1.0.16.Final]
        at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116) [jboss-ejb-client-1.0.16.Final.jar:1.0.16.Final]
        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183) [jboss-ejb-client-1.0.16.Final.jar:1.0.16.Final]
        at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:177) [jboss-ejb-client-1.0.16.Final.jar:1.0.16.Final]
        at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:161) [jboss-ejb-client-1.0.16.Final.jar:1.0.16.Final]
        at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:124) [jboss-ejb-client-1.0.16.Final.jar:1.0.16.Final]
        at $Proxy13.dummyCall(Unknown Source) at hu.commitment.pilot.ejb.TestLocalEjbImpl.callRemoteEJB(TestLocalEjbImpl.java:20) [classes:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at hu.commitment.pilot.ejb.SecurityInterceptor.mdbInterceptor(SecurityInterceptor.java:15) [classes:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
        at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:123) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:248) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
        ... 39 more
      

       

      As you can see it is a log from Jboss EAP 6.1 Alpha, but I get the same running Jboss AS 7.1.2.

       

      If I hardcode the username and the password on "Server A", the remote EJB call works works, but then I cannot get the username of the currently logged in user in the remote EJB:

      (the username is in the remote-outbound-connection tag)

      <security-realm name="ejb-security-realm">
        <server-identities>
            <secret value="YXNkX3F3ZTEyMw=="/>
        </server-identities>
      </security-realm>
      
      
      <!-- ... -->
      
      
      <subsystem xmlns="urn:jboss:domain:remoting:1.1">
                  <connector name="remoting-connector" socket-binding="remoting" security-realm="ejb-security-realm"/>
                  <outbound-connections>
                      <remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="remote-ejb" username="ejbUser" security-realm="ejb-security-realm">
                          <properties>
                              <property name="SASL_POLICY_NOANONYMOUS" value="false"/>
                              <property name="SSL_ENABLED" value="false"/>
                          </properties>
                      </remote-outbound-connection>
                  </outbound-connections>
              </subsystem>
      
      

       

       

      We need the current user's name on the remote side (Server B) because we want to do some Database operations, and we have to set the "updated_by" fields of the entities. The worst solution would be adding the current user's name to every single Remote EJB call, this is not we want. If you know any other solution let me know please, the only one that I've found is using the EJB Security, but I cannot configure it correctly.

       

      Thank You for any help!