title: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING]
body: <p>I created two projects: server-side and client-side. I've got a success by deploying server-side, but I can't connect to it from client. Here is my code:</p>
  
  <p>RemoteCalculator.java:</p>
  
  <pre><code>package com.calculator;
  import javax.ejb.Remote;
  
  @Remote
  public interface RemoteCalculator {
      int add( int op1, int op2 );
  }
  </code></pre>
  
  <hr>
  
  <p>CalculatorBean.java:</p>
  
  <pre><code>package com.calculator;
  import javax.ejb.Stateless;
  
  @Stateless
  public class CalculatorBean implements RemoteCalculator {
      @Override
      public int add( int op1, int op2 ) {
          return op1 + op2;
      }
  }
  </code></pre>
  
  <hr>
  
  <p>I assembled it with maven. Here I show you invoking part:</p>
  
  <p>EJB_Client.java:</p>
  
  <pre><code>public class EJBClient {
      private static void invokeStatelessBean() throws NamingException {
          RemoteCalculator statelessRemoteCalculator = lookupRemoteStatelessCalculator();
          int sum = statelessRemoteCalculator.add( 3, 4 );
          System.out.println( "sum = " + sum );
      }
  
      private static RemoteCalculator lookupRemoteStatelessCalculator() throws NamingException {
          Security.addProvider( new JBossSaslProvider() );
          final Hashtable&lt;String, String&gt; p = new Hashtable&lt;String, String&gt;();
          p.put( Context.PROVIDER_URL, "remote://127.0.0.1:1099" );
          p.put( Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming" );
          p.put( Context.SECURITY_PRINCIPAL, "admin" );
          p.put( Context.SECURITY_CREDENTIALS, "jboss" );
          final Context context = new InitialContext( p );
  
          return ( RemoteCalculator ) context
              .lookup( "java:/ejb-remote-stateless-1.0-SNAPSHOT/CalculatorBean!com.calculator.RemoteCalculator" );
  }
  
      public static void main( String... args ) throws NamingException {
          invokeStatelessBean();
      }
  }
  </code></pre>
  
  <hr>
  
  <p>On running main-method, I got this log:</p>
  
  <pre><code>Exception in thread "main" javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING]
      at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
      at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
      at javax.naming.InitialContext.init(InitialContext.java:242)
      at javax.naming.InitialContext.&lt;init&gt;(InitialContext.java:216)
      at Main.lookupRemoteStatelessCalculator(Main.java:31)
      at Main.main(Main.java:46)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
  Caused by: java.lang.RuntimeException: Operation failed with status WAITING
      at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:89)
      at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:56)
      at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateCachedNamingStore(InitialContextFactory.java:166)
      at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:139)
      at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:104)
      ... 11 more
  </code></pre>
  
  <p>Please, tell me, what is wrong?</p>