title: Remote Ejb bean deployed on Weblogic called from Tomcat web application
body: <p>I have created an remote EJB bean using EJB 3.1 and deployed it on web logic 12c. Now through a simple java client I am able to access the remote bean. It is working fine.</p>
  
  <p>Java Client Code:</p>
  
  <pre><code>Context ctx = null;
            Hashtable ht = new Hashtable();
            ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); 
            ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
          try {
              InitialContext ic = new InitialContext(ht);
  
  }
  </code></pre>
  
  <p>My next approach is to call this remote bean in a web application that is deployed in Tomcat 7. But it is throwing exception</p>
  
  <p>Caused by: java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory.</p>
  
  <p>I am using the following code to call the ejb bean :
  Properties properties = new Properties();</p>
  
  <pre><code>        properties.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
          properties.put("java.naming.factory.url.pkgs", "weblogic.jndi.factories:weblogic.corba.j2ee.naming.url");
          properties.put(Context.PROVIDER_URL, "t3://localhost:7001");
          properties.put( Context.SECURITY_PRINCIPAL, "weblogic");  
          properties.put( Context.SECURITY_CREDENTIALS, "weblogic1");
          try {
            Context ic = new InitialContext(properties); 
  }
  </code></pre>
  
  <p>What to do to make it work. </p>
  
  <p>Thanks</p>