• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Loading EAR files in Java EE 5

 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was reading the sample chapter 11 which you posted here. There's a sample ear file over there containing:

META-INF/application.xml
actionBazaar-ejb.jar
actionBazaar.war
actionBazaar-client.jar
lib/actionBazaar-commons.jar



Then there's the application.xml for this ear:



I noticed that there is no mention of the lib/actionBazaar-commons.jar in this xml. Would this mean that it will be loaded automatically during deployment?

That section further mentions an algorithm which is used to deploy an EAR and how it checks whether the file is an jar. Would this actionBazaar-commons.jar which is in a subfolder "lib" will ever be checked by this algorithm? Just curious
 
author
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikisan,

Probably you did not read the label

Java EE 5 does not
require a deployment descriptor in the EAR module that identifies the type of modules packaged. It is the responsibility of Java EE container to determine the type of module based on its name
(extension) and its content.



The algorithm is for when there is no descriptor (application.xml) in the EAR.

Library e.g. actionBazaar-commons.jar module contains common classes (do not contain any EJB classes) and not a module of of its own and hence it is not deployed as a separate module. The classes packaged in that JAR will be loaded to the application level classloader will be available to all child modules.

Hope this makes sense.

-debu
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Debu Panda:

The algorithm is for when there is no descriptor (application.xml) in the EAR.



I read that, but the reason why i asked this was i did not see a mention of the actionBazaar-commons.jar in the application.xml.
I would have expected it to be mentioned over there as a java module something similar to:



In the applications that i have been working on, that's what i have been doing to have a common utility jar file loaded by the classloader so that the classes in this jar can be accessed by the war as well as the ejb module which are present in the ear. My understanding is that if we dont mention this entry in the application.xml then the actionBazaar-commons.jar will not be loaded and the classes present in this jar will not be available neither for the ejb module nor the war module. Have i got this wrong?
 
Debu Panda
author
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have <module> <java>actionBazaar-commons.jar</java></module>

actionBazaar-commons.jar will betreated as an application client!

lib directory is an extension in Java EE 5 to put helpetr classes /libraries.

By default it is lib but you can customize to whatever directory you want



and then put your jars into


I had a section for this in my draft but the editor thought that's too much for an EJB book ! and I had to get rid of that
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Debu Panda:

lib directory is an extension in Java EE 5 to put helpetr classes /libraries.

By default it is lib but you can customize to whatever directory you want



and then put your jars into



That explains it.

Originally posted by Debu Panda:
I had a section for this in my draft but the editor thought that's too much for an EJB book ! and I had to get rid of that



I wish that was there in the final published version of the book

Thanks Debu for the explanation.
 
Debu Panda
author
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately we can't discuss everything in the horizon in a single book. I agree with the editor that was out of scope for an EJB 3 book. But if you look other EJB books they do not discuss about any such aspects that we dive down in Chapter 11 and you will find such differences in most of other chapters as best practices and things to avoid!
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But if you look other EJB books they do not discuss about any such aspects that we dive down in Chapter 11 and you will find such differences in most of other chapters as best practices and things to avoid!



I agree. I mentioned this in one of the other posts that the classloader section that you have in your Chapter 11 is great. You would not find any discussion on such topics in other EJB books.
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic