users@glassfish.java.net

Problem using remote interface so one enterprise app can access another

From: <glassfish_at_javadesktop.org>
Date: Wed, 11 Feb 2009 22:31:01 PST

I have an enterprise application which contains an EJB which implements a remote interface (@Remote annotation) and provides services to many applications. Let's call this AppA. I have another enterprise application with it's own EJB (AppB) which wants to call AppA. I'm using NetBeans 6.5 (but this shouldn't matter).

AppB has AppA specified as a library so AppB can have access to the remote interface. As such, a copy of AppAEJB.jar is contains within the AppB.ear. When AppB is deployed, GF sees the AppA EJB and registers it with the global JNDI. When AppA is deployed, GF tries to register it with the global JNDI and see's something is already registered under that name. A conflict occurs and AppA fails to deploy.

The real question is how to place AppA's remote interface into a shared library or project so the only thing AppB contains is the remote interface...and not the EJB. I tried to place the remote interface into a library project, but the @Remote annotation then fails because it's not an EJB project. Do I need to forget the annotations and have the remote interface extend java.rmi.Remote? What is the best way to architect this?

Thanks
[Message sent by forum member 'dmocek' (dmocek)]

http://forums.java.net/jive/thread.jspa?messageID=331435