0 Replies Latest reply on Sep 10, 2007 10:22 PM by changemylife

    Error when deploy two beans have same names!

    changemylife

      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 write two clients. Client1 use my.jar and client2 use john.jar

      import my.com.BeanA;
      ...
      Context ctx = new InitialContext();
      BeanA b = (BeanA)ctx.lookup(BeanABean/remote);
      b.add(1,2);


      ---> all works are ok!

      But on the Client2:
      import john.com.BeanA;
      ..
      Context ctx = new InitialContext();
      BeanA b = (BeanA)ctx.lookup(BeanABean/remote);
      b.add(1,2);


      And then, Client2 received error :
      Exception in thread "main" java.lang.ClassCastException: $Proxy0
       at client.ClientTest1.main(ClientTest1.java:18)

      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.