I would like to create a Java EE application with fully separated FrontEnd
and BackEnd
. I found some tutorials where these two modules were packaged into one EAR file. I could create this, and I could deploy my application to the application server.
For security reasons now I have to separately deploy the FrontEnd (Tomcat) and the BackEnd (Weblogic).
What do I have:
Front:
Back:
The communication interface between these two layers would be RMI
calls.
The first solution when I had one EAR project with these two modules were working, because my backEnd module pom.xml packaging was jar
:
<packaging>jar</packaging>
Thus I could include this built jar
to my frontEnd's classpath, and my frontEnd saw the required classes.
Now I tried to create ear from my backEnd because with jar
packaging I cannot inculde required libraries to my backend and they're missing in runtime. So i changed backEnd packaging to ear
in my pom.xml
Ok, but if I have EAR
build from backEnd then i cannot include it to my frontEnd classpath and my frontend cannot see required classes from the backEnd.
I'm sorry i'm totally confused about this. Can you give me any advice or a tutorial about what is the proper way to separate these two modules. For example how is it possible to build an EAR
and a JAR
at the same time with maven
?
Thank you so much!
Somewhere in your project you should have a module with the EJBs and the according packaging type "ejb". Normally an "ejb-client" artefact is also generated. This can be used as a dependency for the frontend. The frontend should be packaged as a "war", the backend as an "ear".
Have a look at the respective maven plugins (EAR, WAR, EJB):
Try this it may help your question.. http://maven.apache.org/plugins/maven-ear-plugin/examples/skinny-wars.html
In a typical J2EE environment, a WAR is packaged within an EAR for deployment. The WAR can contain all its dependent JARs in WEB-INF/lib but then the EAR can quickly grow very large if there are multiple WARs, due to the presence of duplicate JARs. Instead the J2EE specification allows WARs to reference external JARs packaged within the EAR via the Class-Path setting in their MANIFEST.MF.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With