[jboss-user] [EJB/JBoss] - Deploy with two beans have same names inside two packages di

changemylife do-not-reply at jboss.com
Mon Sep 10 00:19:45 EDT 2007

Hi all!
  I use jboss-4.0.5.GA and EJB3.0
  I write two beans that have same name (called BeanA). Example: 
anonymous wrote : 
  |   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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082450#4082450

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082450

More information about the jboss-user mailing list