0 Replies Latest reply on Aug 20, 2002 2:18 PM by Min gao

    could not call another ejb's method on differdent port

    Min gao Newbie

      hi! guys:

      I built two apps to different prots:8080 and 8090. I am trying to useing one side ejb(client) to access another(Server),both sides will have sessinbean to access entitybean.

      Now, I can lookup another SessionBean(server) interface sucessfully, I asume. because the tomcat does not give me error when I compile it. but, it stop when it complie the bussinss method.that is :when I trying call the method in server sessionbean, it give me "cannot resolve symbol,symbol:method getQuantityB"

      what is going on?

      //-------here is my code
      import com.mtp.storeA.product.*;
      import com.mtp.storeB.product.*;
      import com.mtp.storeB.management.*;

      //import com.mtp.storeA.order.*;

      public class CustomerManagementABean implements SessionBean {

      private CustomerManagementBHome customerManagementBHome = null;

      private CustomerManagementBHome getCustomerManagementBHome() throws NamingException {
      //lookup userManagementB interface on port 1090
      Properties prop = new Properties();
      prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      prop.put(Context.PROVIDER_URL, "localhost:1090");

      Context initial = new InitialContext(prop);
      return (CustomerManagementBHome) initial.lookup("CustomerManagementB");
      }//end LocalProductHome

      //CustomerManagementABean grabbing the CustomerBean's home interface
      public void ejbCreate() throws CreateException {
      try {

      customerManagementBHome = getCustomerManagementBHome();
      } catch (Exception e) {
      }//end catch
      }//end ejbCreat

      public void ejbActivate() {
      try {

      customerManagementBHome = getCustomerManagementBHome();

      } catch (NamingException e) {
      }//end catch
      }//end ejbActive

      //business method
      /*public Collection cates() {
      Collection caten = null;
      //using select method and cast productbean get all category
      caten = customerManagementBHome.getCategorys();
      } catch (Exception e) {
      }//end catch
      return caten;//retrun collection have all categorys
      }//end cates
      //find other store's products
      public int getQuantityA(Integer productid) {
      int quantity;
      CustomerManagementB customerMgmtB = customerManagementBHome.create();

      quantity = customerMgmtB.getQuantityB(productid);////---->>>>>>>problem is here
      } catch (Exception e) {
      }//end catch
      return quantity;
      //return (String [] )cateList.toArray(new String[cateList.size()]);
      }//end productInfo

      public void ejbPassivate() {

      customerManagementBHome = null;


      public void ejbRemove() {}

      public void setSessionContext(SessionContext sc) {}