Search code examples
jakarta-eejbossear

EAR dependency to another EAR


I am working with Java EE and I need to create a project with two ear files. In the first one, I have a module that has to be called by a bean of the second one. In the module of the first ear I have create a remote interface that is implemented by a stateless bean (i have annoted both interface and bean with "@Remote", and I have also specified for the stateless bean a mappedName equals to the interface name). Now, in the second ear i have imported the class of the remote interface, and everything goes well. But when I try to deploy the two ears in my application server (jboss eap 6.4), when I try to deploy the second ear (after deployed the first one), it returns an exception saying that it can't find the interface class. How can I solve this problem? Is there some properties that i have to setup? Thanks in advance


Solution

  • The interface class that has been annotated with @Remote must be present and visible to callers in both EAR files.

    Typically, you would build a separate foo-api.jar containing this class (and possibly other dependencies such as DTOs) and place it in the "lib" directory of each EAR file.