• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Java ear package classpath

 
Ranch Hand
Posts: 185
Netbeans IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

can someone give me a quick summary about java ear package types default classpath? For example:

If I have an ear file that contains numerous war files and jar files. Let's also say that each war file has a lib dir with some jars in it. Can all these jars/wars "see" each other by default when the ear file is launched? In other words, is every class accessible to one another as all of these classes go into the classpath when the ear is loaded?

Thanks

edit: further note, I am looking at an ear deployed on a jboss app server which is why I ask. There is a single ear with multiple web apps (wars), each web app has a lib dir with some jars, and there are also jars located in the ear files lib directory.
 
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends on the class loader implementation on how the classes will be loaded. It is recommended to have a shared library instead of having multiple JAR files inside your EAR/WAR files. There may be possible duplicate JAR files in your class path which may behave inconsistently at run time/deploy time. So you can move all the common JAR files to a shared library and deploy it in the application server. You must keep only the most specific JAR files you need inside the lib folders of EAR/WAR files.

You must create a configuration XML which is standard for your app server (Example: weblogic.xml for Weblogic App server) and you can refer this shared library name in that configuration XML. This will reduce the EAR /WAR file size to a great extent.

Thanks,
Vijay
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic