Skip to main content

Glassfish3 deployment options for third party libraries

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
table1
Offline
Joined: 2007-09-08

We deploy multiple web applications on glassfish 3.1.x application server. I would like to separate out third party libraries out of the individual war files and add them to a common location so that the deployment time is reduced. As a additional advantage the disk space is also reduced.

I tried adding the libraries in the domain/lib directory. The only issue I face is logging. We use slf4j and logback for application logging (some of the third party libraries also use the same). Since the libraries are in domain/lib while the configuration files (logback.xml) are in individual war files, logback does not find them and start logging in default mode (debug) for all packages.

How can I configure my applications such that the third party libraries are placed at a central location in glassfish and the logging is done as per the configuration files (logback.xml) from the individual web applications?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
table1
Offline
Joined: 2007-09-08

Logback provides a way to have the same set of logging libraries loaded for multiple applications deployed on the glassfish container. I had to make two changes to make this work
1. add a jndi entry to specify the context name in web.xml
2. place the logback-.xml configuration file in WEB-INF\classes (or lib).

This way logging is controlled by each web application and the libraries are kept at a central location.

Thanks!