Jar's Wars Ears and classpaths once and for all
gags_78 Feb 7, 2003 7:15 PM
"gags_78" wrote:"gags_78" wrote:
Hi there,
I've been confused for some time about the interactions of jars and wars, ears, knees, toes etc..
I've narrowed it down to a couple of questions.
Say I have a standalone jar-file, app1-ejb.jar, file containing an EJB
i.e.
Bean class
home&remote interfaces
ejb-jar.xml & jboss.xml descriptors
Manifest.ms file
application.xml file
This bean must make reference to another bean located on another jboss engine on a remote machine just to explicitness'
sake. This bean is app2-ejb.jar and contains the exact same file structure as app1-ejb.jar. note they are seperate
applications providing diverse services.
From what I understand and please correct me if I'm wrong cos this is proving hasslesome, in order for app1-ejb.jar to be
able to access app2-ejb.jar's interfaces I must jar them up the interfaces directly into the app1-ejb.jar file instead of being
able to jar them into an interface jar, namely app2Client-interfaces.jar that only contains the home and remote
interfaces for app2. Is this correct? So basically I can jar up the interface classes fine explicitly but if I attempt to include
them jarred up I'm outta luck? Even if I include a manifest that declares a classpath pointing to them?
I think I understand that if I was to create a j2ee application app1.ear then I can include the interface jar for app2 within
this app1.ear file, amend the classpath in the ear's manifest file to point to the app2 interface jar then I'm elected again.
There's just no way to include the interfaces jarred up within the standalone ejb jar file.
I hope this is making sense and not just annoying folks.
Secondly when I'm earing up my app1.ear file which now contains a WAR and a JAR the structure I'm coming out with is
like so: -
1 app.ear file containing :
1 app-ejb.jar file
some client-interface.jars for beans accessed by app-ejb.jar
1 app-war.war file
A manifest file indicating the classpath for the EJB
The app-war.war file in itself containing:-
Some jsp files
Copies of the same client-interface.jars
Copy of the app-ejb.jar file
a Manifest file indicating the classpath for the EJB in the WAR
Is there no way to direct any client access request that does NOT originate thru one of the war's jsps to the bean
contained app1-ejb.jar of the war file instead of having to include two versions of the same ejb in the same ear file? It seems wasteful so much so that I'm beginning to question whether I've just got this all wrong.
Please keep in mind I'm quite new to EJB and the whole J2EE platform and honestly I inherited much off my jarring and warring practice from a colleague so if I'm well off base then I do apologise for wasting everyones time and would greatly appreciate being set straight...
Please excuse my spelling it out so bluntly but I've never come across a proper explanation of this and it's beginning to annoy me also I'm wondering why a proper thorough idiot proof explanation, (expressly for the likes of muggins here) isn't available?
Thanks very much for taking the time to read this and any help would be thoroughly appreciated.
Thanks,
Mark.