dev@glassfish.java.net

purpose of extracting jars in web apps to generated directory?

From: Dies Koper <diesk_at_fast.au.fujitsu.com>
Date: Wed, 4 Feb 2009 14:47:31 +1100

Hi Jan,

I have a question about the implementation of WebappClassLoader.

When including a jar with resources in a web app's WEB-INF/lib, at the
moment a resource is first accessed from the application the jar's
contents is extracted into the generated directory.

This means that when there are many resources in a jar, there is a long
delay when accessing the first resource. This is also noticeable when
accessing the admin console each time after starting the domain.

Do you know why is it implemented this way?

I figured the reason is to work around redeployment problems due to file
locks on jar files. If this is the case, have you considered redesigning
the web classloader in the same way the EJB classloader is designed,
i.e. closing the open streams when the classloader is discarded during
re-/undeployment?

Thanks,
Dies