I am then including the generated ejb in my WAR as follows:
Finally, in my EAR, I have the following:
The EAR builds properly. The issue that I have is that is that the EJB
module is added in both the root of my EAR and in the
servlet.war/WEB-INF/lib folder. The classloader then finds 2 copies of the
classes in my application - one from the WAR and the one from the EAR.
Obviously, this is not right. But I am not sure what the right way to do
this is. Am I obliged to generate an ejb-client and include the ejb-client
in my WAR only? However, then I will still have 2 copies of the interface -
one in the ejb jar and one in the ejb-client.jar. How does this improve the
situation of duplicate classes in the classloader?
Furthermore, I noticed that the ejb-plugin doesn't just put the EJB
interfaces in the client package. By default it puts any Bean inner
classes as well as utility classes, etc. I realize that I can manually
configure the plugin to specify exactly which classes to include or
exclude, but that seems like it is not following the maven conventions over
What are the best practices and approaches for using EJBs with Maven? What
is the best way to build a WAR/EAR with Maven?