Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

servlets - Is Java 9 modularity for WAR files as well?

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...