Accessing local interface using ejb3 and weblogic


EJB programming & troubleshooting: Accessing local interface using ejb3 and weblogic

  1. Accessing local interface using ejb3 and weblogic (3 messages)

    Hi, I am a newbie to EJB3. I have written simple bean and am able to access the remote interface through the client. How do i access the local interface through client (similar to getejbhome and create() using ejb2.0). How do i do that using weblogic? I tried using java:comp/env/ejb in my client and put entries in ejb-jar.xml but i get naming exception. I am really frustrated. Please help!! Thanks
  2. Hi, I am not sure what client you are using. If it is an application client then you cannot access the Local interface from that because it will not be available. Only remote interfaces will be available at the application client. Probably you can try accessing the Local interface from a Servlet or from a Session bean. Hope my reply helps.
  3. hi all, Help needed in resolving javax.naming.NameNotFoundException when i try to invoke the remote ejb object of EJB3. The ejb is deployed in the weblogic server without any errors. I can see the ejb jar file deployed in the ejb container of weblogic through the admin console. Please find the source code snippet below.... Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); ht.put(Context.PROVIDER_URL, "t3://"); InitialContext ctx = null; ctx = new InitialContext(ht); Object obj = (Object)ctx.lookup("com.acs.test.emp.EmployeeBean"); EmployeeRemote empRemote = (EmployeeRemote)PortableRemoteObject.narrow(obj,com.acs.test.emp.EmployeeRemote.class); List empList = empRemote.getEmployeeDetails(1); System.out.println("SUCCESS"+empList.size());
  4. Hi, For you need to change the lookup code. It should be context.lookup("EJBName#RemoteInterfaceWithPackage"); Another thing is you dont need to use Narrow for EJB3. -Sachin