Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 937273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:27:04+00:00 2026-05-15T21:27:04+00:00

I am trying to load some classes that are common to all the web

  • 0

I am trying to load some classes that are common to all the web applications of my ear in a java ee 5 application.

I tried to do this by putting the classes (not jar) in
a) directory called “lib”

b) also specifying in application.xml’s

   <module><java>lib/common.jar</java></module> 

and was not successful by either option a or b

but when I jarred the classes into common.jar, I was able to load the classes by method b)

  1. Do both these method need the classes to be jarred ?
  2. what is the difference between providing the classes via the above 2 methods ? why does it seem like there are two ways to specify loading common classes ?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:27:05+00:00Added an answer on May 15, 2026 at 9:27 pm

    I’m not sure which application server is being referred to here, and the nature of the common.jar file. For now, I’ll assume that the application server is any Java EE 5 container, and that the common.jar file is a utility jar (and not an EJB or similar module).

    The Java EE 5 Platform Specification actually defines the manner in which library support is to be provided by containers:

    A .ear file may contain a directory that contains libraries packaged in JAR files. The library-directory element of the .ear file’s deployment descriptor contains the name of this directory. If a library-directory element isn’t specified, or if the .ear file does not contain a deployment descriptor, the directory named lib is used. An empty library-directory element may be used to specify that there is no library directory.
    All files in this directory (but not subdirectories) with a .jar extension must be made available to all components packaged in the EAR file, including application clients. These libraries may reference other libraries, either bundled with the application or installed separately, using any of the techniques described herein.

    This does not mean that method B is incorrect, it is the one to be used for application servers like JBoss 4, that did not support the library-directory element in application.xml. I believe, Glassfish also supports the lib directory concept without a corresponding library-directory element.

    Coming back to the question, placing classes alone in a directory in the EAR file appears to be supported only in WebLogic Server via the APP-INF\classes structure (needless to say, this is not a platform standard). Hence, it is recommended to jar the common classes and use the application server supported mechanism to make these common classes available to other modules in the application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a simple application that loads and runs some classes during
I am trying to load some XML data into C++ code (classes) using gsoap.
All, I'm trying to load some content into a fancybox. I'd like to load
I'm new to java. I'm trying to use some dynamically loaded classes in my
I have a legacy application that I'm trying to port to Java EE. Presently
I'm trying to build my first ruby gem that contains some classes I want
I am trying to load some images in a scrollable pane. But for some
I am trying to load some info from the database asynchronously. I have a
I'm trying to load some images using Bitmap.getBitmapResource() , but it takes about 2
I am trying to load some .dds textures for my game. My IDE is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.