5 Replies Latest reply on Sep 13, 2007 9:59 AM by wayne baylor

    Deploy with two beans have same names inside two packages di

    LeQuoc Thai Novice

      Hi all!
      I use jboss-4.0.5.GA and EJB3.0
      I write two beans that have same name (called BeanA). Example:


      Inside package: my.com has a bean called BeanA and exported to "my.jar"
      Inside package: john.com has a bean called Bean A and exported to "john.jar"

      I deployed two jars follow order: my.jar is first, and john.jar is second. Deploying two jars (my.jar and john.jar) is Ok!
      On the client side, I import two jars, and call add method:

      import my.com.BeanA; --> The first, I import BeanA from my.com
      ...
      Context ctx = new InitialContext();
      BeanA b = (BeanA)ctx.lookup(BeanABean/remote);
      b.add(1,2);
      

      ---> all works are ok!
      But when I change import statement:
      import john.com.BeanA; (not my.com.BeanA)

      And then, I received ClassCastException error at line:
      BeanA b = (BeanA)ctx.lookup(BeanABean/remote);

      I think that my.jar is first deployed so my works are success! And JBoss not recognize john.jar when it deployed after, so my works are fail !
      Have ideas about this problem? Please guide to me!
      Thanks very much.