1 Reply Latest reply: Apr 7, 2012 2:52 PM by dvohra21 RSS

    How to reference a EJB interface in another EJB application?

    SMEC_Matt
      Hi, everyone. I am new to EJB 3.0 and I encounted some dependency and deployment problem.

      I have two EJB applications, EjbApp1 and EjbApp2, which will be deployed in the same weblogic server..
      EjbApp1 has local and remote interface IEjbInterface1 and IEjbInterfaceLocal1, and a session bean SessionBean1 implements the two interface.
      EjbApp2 has local and remote interface IEjbInterface2 and IEjbInterfaceLocal2, and a session bean SessionBean2 implements the two interface.

      One method of SessionBean2 needs to call a method of SessionBean1. I want to use the @EJB annotation to inject IEjbInterface1 into SessionBean2.

      So here is what i do:

      1. I pack IEjbInterface1.class in a .jar and import the classes to EjbApp2.
      2. In SessionBean2.java, I inject SessionBean1 using the code below:

      +@EJB(beanInterface = IEjbInterface1.class,
      mappedName = "EjbApp1-EJBProject-IEjbInterface1")
      IEjbInterface1 iEjbInterface1;+

      3. I deploy EjbApp1 and EjbApp2 to weblogic server.
      4. Then I create a test client to call a method in SessionBean2, I get a Class not found Exception which indicates that one of the entity classes of EjbApp1 in not found.

      I am sure that I am doing something wrong here.
      Could anyone tell me what is the standard practice to reference a deployed EJB interface in another EJB application?

      Thank you.