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 562129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:31:20+00:00 2026-05-13T12:31:20+00:00

I m new to Jboss, but I have multiple web applications each using spring-hibernate

  • 0

I m new to Jboss, but I have multiple web applications each using spring-hibernate and other open source libraries and portlets, so basically now each war file includes those jar files. How do I move these jars to a common location so that I don’t have to put these in each war file? I guess location is server/default/lib, but I’m not sure.

Also, how is it different to have those jars at WEB-INF/lib vs. JBOSS/server/default/lib? Will I face any classloader issue?

Also I have static data stored in static fields like Singleton, will those be shared across all WAR files?

  • 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-13T12:31:21+00:00Added an answer on May 13, 2026 at 12:31 pm

    Classloading:

    You’re right, put the .jars to JBOSS/server/<configuration>/lib, or JBOSS/lib.

    JBoss AS comes with bundled Hibernate libs which are tested with that AS version.

    See jboss-6.0.0-SNAPSHOT\server\default\conf\jboss-service.xml:

    <server>
      <!-- Load all jars from the JBOSS_HOME/server/<config>/lib directory and
           the shared JBOSS_HOME/common/lib directory. This can be restricted to
           specific jars by specifying them in the archives attribute.
           TODO: Move this configuration elsewhere
      -->
      <classpath codebase="${jboss.server.lib.url}" archives="*"/>
      <classpath codebase="${jboss.common.lib.url}" archives="*"/>
    </server>
    

    Also see:

    • http://community.jboss.org/wiki/classloadingconfiguration
    • http://community.jboss.org/wiki/JbossClassLoadingUseCases

    Difference between WEB-INF/lib and JBOSS/server/default/lib:

    Libs in WEB/lib come with your WAR and are only visible within that WAR.
    If you have other module, e.g. EJB JAR, they will not be visible from it and you’ll get ClassNotFoundException or (if you have the class in multiple places) ClassCastException.

    Libs in JBOSS-AS/server/<config>/lib are visible for whole server, thus all deployed apps and their modules. However (IIRC) they don’t have precedence, so if you bring that lib e.g. in a WAR, but not in EJB jar, you can end up using two different versions, which is undesirable (will likely lead to aforementioned ClassCastException).

    Class loading behavior may be tweaked several ways, see e.g. JBoss wiki.

    Static data:

    Don’t rely on static fields in Java EE, that brings troubles. For instance,. the same class can be loaded by different classloaders, so there will be multiple instances of these static values.
    If you want to share data amongst more WARs, use an external storage – a database, a file (with synchronization if you write to it), JBoss Cache, etc.

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

Sidebar

Related Questions

I am new to Spring and hibernate please help, I am using (Jboss 6.0
I've been using Tomcat for years, but I have been put on a new
I have a problem deploying an Axis 2 web application. I'm using Jboss 4.2.0,
It appears that we will have to build/deploy one of our new JBoss apps
new to JBoss and am configuring some applications. I know how to do this
I am new to the Java / Hibernate / Seam way of development but
Given a web application built using Jboss seam with following details: dynamic web module:
I am new to creating Java web applications and came across this problem when
I have a Java EE web application using features from the Java EE 6
I have a simple web service running on a JBoss server. Now I need

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.