The WEB-Inf/lib directory of a web application is for jar files, which a servlet-container (e.g. Tomcat) takes automatically into the classpath of the application. Are there any ideas how this mechanism works (or should work in the future) for modularized jars of Java 9? These provide modules, where the user must specify which contained/exported modules/package should be used by the application. There is a module path additionally to the (old) classpath.
Does a modularized jar work without any further specifications/configurations such that all exported or contained modules are on the classpath then?
Java EE 8 and Tomcat 9 are released. Both projects claim to support Java 9. Thus, there should be a way to use Java 9 modules in a manner that complies to the modules idea.
jaxb-api.jar
version 2.3.0 (link), which one may want to use inWEB-INF/lib
of a web app, sincejavax.xml.bind
is deprecated now in the Java API. – chris21kjava --module-path lib
you can advise the jvm where to search for modular jars. With--add-modules one.java.mod.a
you can then set the packages of the moduleone.java.mod.a
say, e.g., inlib/libx.jar
onto the classpath of the jvm. This is only possible iflib/libx.jar
explicitely exports the moduleone.java.mod.a
. There may be other modules (with other names) inlib/libx.jar
or in other jars in thelib
directory which are also exported/accessible from outside, say, e.g.,one.java.mod.b
. – chris21kWEB-INF/lib
is still a thing. I have the impression that the single application-server, multiple applications deployment model is dead, and with it, the use of multiple, hierarchical classloaders. The last time I saw a single JVM running more than one web application (let alone that these are independenty deployed) is probably a decade ago. If a single JVM runs a single application, you can just pass modules the normal way, and you don't need a drop-in directory. Point is: I wouldn't be too surprised if this is unsupported. – Barend