title: java EJB error Address is invalid on local machine
body: <p>I am trying to connect to an EJB on Websphere server using <code>Context.lookup()</code>.</p>
  
  <p>My code works fine when the application is hosted on a local Websphere server, but when I try to connect to the application which is installed on a remote server, I am getting following errors:</p>
  
  <blockquote>
    <p>... </p>
    
    <p>Caused by: org.omg.CORBA.TRANSIENT: initial and forwarded IOR
    inaccessible  vmcid: 0x4942f000  minor code: 3591  completed: No </p>
    
    <p>...</p>
    
    <p>Caused by: java.net.ConnectException: connect: Address is invalid on
    local machine, or port is not valid on remote machine </p>
    
    <p>...</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>String initialContextFactory="com.ibm.websphere.naming.WsnInitialContextFactory";
  String providerUrl="iiop://localhost:9100";
  
  Hashtable&lt;String, String&gt; environment=new Hashtable&lt;String, String&gt;();
  environment.put(Context.INITIAL_CONTEXT_FACTORY,initialContextFactory);
  environment.put(Context.PROVIDER_URL,providerUrl);
  
  Context ctx=new InitialContext(environment);
  obj=ctx.lookup("com.xyz.Test");
  </code></pre>