title: Glassfish 4 Acessing EJBs via Standalone Application
body: <p>I am trying to access an EJB via JSE Standalone application.</p>
  
  <p>I was struggling a lot with JNDI Names not being found during lookup.</p>
  
  <p>After some research without any solution I found in the Glassfish server log after a deploy a message stating something like:</p>
  
  <p>"[glassfish 4.1] [INFO] [AS-EJB-00054] [javax.enterprise.ejb.container] [tid: _ThreadID=47 _ThreadName=admin-listener(4)] [timeMillis: 1424811833554] [levelValue: 800] [[ Portable JNDI names for EJB HelloBean:java:global/ponteWS/HelloBean!br.com.pontews.HelloRemote, java:global/ponteWS/HelloBean!br.com.pontews.HelloBean]]]
  "</p>
  
  <p>I tried the remote name and voilá!!! It works.</p>
  
  <p>I tried the other name and did not work.</p>
  
  <p>Here comes the questions:</p>
  
  <p>1-Why the JNDI name is so weird???? Is there something I can do in order to avoid the package name in front of the name of the bean?
  2-What is the error I get when acessing the bean directly instead the HelloRemote Interface?</p>
  
  <p>Here is the HelloRemote:</p>
  
  <pre><code>package br.com.pontews;
  
  import javax.ejb.Remote;
  
  @Remote
  public interface HelloRemote {
  
      public String sayHello(String name);
  }
  </code></pre>
  
  <p>Here is the Bean:</p>
  
  <pre><code>package br.com.pontews;
  import java.io.Serializable;
  import javax.ejb.LocalBean;
  import javax.ejb.Remote;
  import javax.ejb.Stateless;
  
  @Stateless(name="HelloBean")
  @LocalBean
  @Remote
  public class HelloBean implements HelloRemote, Serializable {
  
      /**
       * 
       */
      private static final long   serialVersionUID    = 1L;
  
      /**
       * Default constructor.
       */
      public HelloBean() {
      }
  
      public String sayHello(String name) {
          return "Hello," + name + ".!" ;
      }
  
  }
  </code></pre>
  
  <p>Here is the call that works:</p>
  
  <pre><code>Object lookup = 
  ctx.lookup("java:global/ponteWS/HelloBean!br.com.pontews.HelloRemote");
  </code></pre>
  
  <p>Here is the call that does not works:</p>
  
  <pre><code>Object lookup = 
  ctx.lookup("java:global/ponteWS/HelloBean!br.com.pontews.HelloBean");
  </code></pre>
  
  <p>And finally the error I get with call that does not work:</p>
  
  <p>Exception in thread "main" javax.naming.CommunicationException: Communication exception for SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is java.rmi.RemoteException: CORBA NO_IMPLEMENT 1398079489 Maybe; nested exception is: 
      org.omg.CORBA.NO_IMPLEMENT: ----------BEGIN server-side stack trace----------
  org.omg.CORBA.NO_IMPLEMENT: WARNING: 01000001: Missing local value implementation  vmcid: SUN  minor code: 1 completed: Maybe
  :
  :
  :
  Caused by: java.lang.ClassNotFoundException: br.com.pontews.<strong>EJB31_Generated__HelloBean__Intf____Bean</strong> <strong>(no security manager: RMI class loader disabled)</strong></p>
  
  <p>Thanks</p>