Topic
  • 3 replies
  • Latest Post - ‏2012-12-05T14:18:19Z by Kenneth.Stephen
Kenneth.Stephen
Kenneth.Stephen
4 Posts

Pinned topic Has anyone gotten the Local interface EJB method invocation to work?

‏2012-11-28T03:08:13Z |
The EJBSampleServer example works as advertised, but it uses the no-interface view. Here is my code:

@WebServlet("/hello")
public class Hello extends HttpServlet
{
@EJB(beanInterface=DataLocal.class, beanName="ejb/firstEJB") DataLocal dl;

---

@Stateless
@Local(DataLocal.class)
@LocalBean
public class Data implements DataLocal {

....

public interface DataLocal

...

I tried without the beanName and binding (ibm-web-bnd.xml), but it didn't work. Doesn't work with bindings either. I consistently get:

11/27/12 21:30:35:961 EST 00000053 com.ibm.wsspi.injectionengine.InjectionBinding E CWNEN0030E: The EJB factory encountered a problem getting the object instance Reference Class Name: com.ibm.issw.liberty.beans.view.DataLocal
Type: EJBLinkInfo
Content: com.ibm.ws.ejbcontainer.injection.factory.EJBLinkInfo@1f2b1f2b
binding object.

Has anyone gotten this working?

Regards,
Kenneth
  • RohitK
    RohitK
    6 Posts

    Re: Has anyone gotten the Local interface EJB method invocation to work?

    ‏2012-11-28T15:54:48Z  
    Can you please send us your sample app .

    -Thanks,
    Rohit
  • Tracy-B.
    Tracy-B.
    1 Post

    Re: Has anyone gotten the Local interface EJB method invocation to work?

    ‏2012-11-28T17:02:36Z  
    Bindings for ejb references are not supported in the alpha; only ejb-link/beanName and auto-link are supported, and the EJB must be packaged in a JAR file that is part of the same application (EAR) as the servlet (WAR).

    In your snippets, assuming that your servlet is in a WAR that is in the same EAR as your EJB JAR file, then it should work either without the beanName parameter, or with the beanName parameter properly defined.

    In your example, the name of the EJB would appear to be "Data", not "ejb/firstEJB". When using beanName, it needs to match the value specified for 'name' on the @Stateless annotation, or the default name, which is the simple name for the bean
    implementation class (Data in this case).
  • Kenneth.Stephen
    Kenneth.Stephen
    4 Posts

    Re: Has anyone gotten the Local interface EJB method invocation to work?

    ‏2012-12-05T14:18:19Z  
    The EJB injection wasn't working correctly for me because of a conflict with the jaxws-2.2 feature. Once I turned that off, things worked.

    Regards,
    Kenneth