[jboss-user] [Installation, Configuration & DEPLOYMENT] - Error when deploy two beans have same names!

changemylife do-not-reply at jboss.com
Mon Sep 10 22:22:13 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 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.

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

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



More information about the jboss-user mailing list