Discussion:
war/WEB-INF/lib in JPMS concept
Alex Sviridov
2018-09-28 16:06:24 UTC
Permalink
If we place .war file on JPMS layer and this .war file has .jars in WEB-INF/lib what we should
do with these jars? Should we deploy them at the the same JPMS layer with .war module?
I mean :
JPMS layer:
- war module
- jarmodule1_from_war
- jarmodule2_from_war
...
- jarmoduleN_from_war?

Or should we create for them another layer? Or somethi
Alan Bateman
2018-09-28 16:45:30 UTC
Permalink
Post by Alex Sviridov
If we place .war file on JPMS layer and this .war file has .jars in WEB-INF/lib what we should
do with these jars? Should we deploy them at the the same JPMS layer with .war module?
- war module
- jarmodule1_from_war
- jarmodule2_from_war
...
- jarmoduleN_from_war?
Or should we create for them another layer? Or something else?
This may need someone familiar with servlet or other Java EE specs to
comment. I think, but not certain, that there is something in the
servlet spec about the classes in these JAR files needing to be visible
to the web application class loader. I think it may have something to
imply that the classes in the web application and the classes loaded
from lib/* are defined to the same class loader. In any case, if there
are no overlapping packages then you should be able to map all of the
modules to the same class loader (defineModuelsWithOneLoader) and it
should work.

-Alan.
Alex Sviridov
2018-09-28 16:59:18 UTC
Permalink
Do I understand you right - you suggest to take these jars from /lib and deploy
them on the same layer (where is .war module) as independent modules.
And when we create this layer we create one class loader for all modules?

Best regards, Alex
Post by Alan Bateman
Post by Alex Sviridov
If we place .war file on JPMS layer and this .war file has .jars in WEB-INF/lib what we should
do with these jars? Should we deploy them at the the same JPMS layer with .war module?
- war module
- jarmodule1_from_war
- jarmodule2_from_war
...
- jarmoduleN_from_war?
Or should we create for them another layer? Or something else?
This may need someone familiar with servlet or other Java EE specs to
comment. I think, but not certain, that there is something in the
servlet spec about the classes in these JAR files needing to be visible
to the web application class loader. I think it may have something to
imply that the classes in the web application and the classes loaded
from lib/* are defined to the same class loader. In any case, if there
are no overlapping packages then you should be able to map all of the
modules to the same class loader (defineModuelsWithOneLoader) and it
should work.
-A
Alan Bateman
2018-09-28 18:44:02 UTC
Permalink
Post by Alex Sviridov
Do I understand you right - you suggest to take these jars from /lib and deploy
them on the same layer (where is .war module) as independent modules.
And when we create this layer we create one class loader for all modules?
If there were sharing of the modules in WEB-INF/lib between different
web applications then you could resolve those and put them in their own
configuration and module layer. If there is no sharing then one
configuration and module layer sounds right.

-Alan

Loading...