1

I am stuck on a JNDI binding process on EJB3 and here is the source code which I am terribly stuck at.

/*
     * Create session bean.
     */
    public static AG20BWOPortal getSessionBean() throws NamingException, RemoteException, CreateException{
        if(wo == null){
            Context ic = new InitialContext();
            System.out.println("test1");
            Object obj = ic.lookup("ejb/sg/gov/hdb/ag20/ejb/AG20BWOPortalHome");  //JNDI name (from EJB module xmi file)
            System.out.println("test2");
            AG20BWOPortalHome home = (AG20BWOPortalHome) PortableRemoteObject.narrow(obj, AG20BWOPortalHome.class);
            wo = home.create();
        }
        return wo;
    }

My questions are

  • The home interface is removed as part of EJB3 migration process, hence how do I replace the home interfaces?

  • How do I bind in EJB3 standard?

  • Which application server are you using? What does your EJB look like? When you say "how do I bind", do you mean "how do I lookup"? Note that JNDI lookup names were vendor-specific prior to EJB 3.1 – Brett Kail Oct 11 '15 at 17:14
  • I am sorry to keep this hanging - I would like to mention that this had been solved and post the solutions soon enough :) – Farath Shba Oct 23 '15 at 03:23

1 Answers1

1

I am answering this on my own if anyone want to catch the drift of how I did this.

  1. EJB Implementation Class -> @Stateless Annotation
  2. EJB Remote Interface -> @Remote Annotation

This would bind the EJB classes together.

PS: Do not forget to remove the extends from EJB's remote interface as well.