java - is it not allowed to implement a single local interface by two stateless beans? -
i getting following exception when local interface implemented 2 stateless beans, in 1 having normal functionality , other having enhanced functionality in it.
java.lang.runtimeexception: not resolve global jndi name @ejb container userbean: reference class: org.app.securityservicelocal ejblink: duplicated in some.jar
finally came know why getting exception
i have used @ejb annotation inject stateless bean stateless bean name userbean following code
@stateless(name="userbean") @ejb(name="app/securityservice", beaninterface=securityservicelocal.class) public class userbean implements userremote{ }
if check injection details injecting securityservicelocal, implemented 2 stateless bean classes name sercurityservicebean , securityserviceenhabean. so, container in ambiguity state decide bean inject in both implementing same interface.
this can resolved specifying more information beanname property value in @ejb annotation. there need provide stateless bean class needs injected using bean name(declared @ bean level (or) in ejb-jar.xml). check code identify change in injection mapping
@stateless(name="userbean") @ejb(name="app/securityservice", beaninterface=securityservicelocal.class, beanname="securityserviceenha") public class userbean implements userremote{ }
Comments
Post a Comment