Reusing @Remote interface in two J2EE applications
We have a main application and a client application deployed on Glassfish 3.1. The main application invokes the client application through a JNDI lookup over a @Remote
开发者_开发技巧 interface. Now we tried to deploy another client application that uses the same @Remote
interface, hoping to be able to invoke both applications but just changing target EJB name. However, we received the following exception:
Caused by: java.lang.RuntimeException: Error while binding JNDI name com.company.ClientRemote for EJB : Client2
at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1550)
at com.sun.ejb.containers.StatelessSessionContainer.initializeHome(StatelessSessionContainer.java:202)
at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:167)
at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:234)
... 67 more
Caused by: javax.naming.NameAlreadyBoundException: Use rebind to override
Both clients need to have a common functionality, and this functionality is used by the main application when it invokes the clients.
How do you suggest to go around this?
Thanks!
精彩评论