Is Java 9 modularity for WAR files as well?

malloc4k :

A Java EE 7 application server, and specifically a Servlet 3.1 container should allow us to deploy a WAR file that contains a web application. And a WAR file is essentially a JAR with deployment descriptor (web.xml) and couple of other elements.

On the other hand, Java 9 introduces a notion of modular JAR file, that is, a JAR with module descriptor (module-info.class) which makes a module in terms of project Jigsaw.

So, can a WAR file contain a module descriptor as well and make a "modular WAR file"?

Are there already application servers capable of accepting deployment of a "modular WAR file"?

Generally what is the future of servlet containers and WAR files in terms of Java 9 modularity ?

Tomaz Cerar :

Currently there are no links between Java EE and java 9(jigsaw) modules. Future Java EE releases might introduce spec defined behavior on how to interact with jigsaw modules.

At this point all app servers run in "classpath mode" when running on JDK9 which in practice mean they do not utilize jigsaw.

In most cases introducing module-info to your war deployment can only cause deployment issues as JDK might try to load it in different way than other parts of the app server. Or it could not even make a difference as most app servers have custom logic for loading jars & classes.

Some application servers out there today already implement some kind of modularity such as OSGi(GlassFish, Liberty) or jboss-modules (Wildfly) But at this time jigsaw still has some limitations to be able to run such modular systems on top of it.

So in short, until there is EE spec (probably 9+) that is updated to describe how EE deployments should run on jigsaw enabled runtime there is no "official" way on how such deployment should behave. Until such time, each app server can implement some custom support for it but it wont be standard.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=426732&siteId=1