1

Is it possible for a .war project to be deployed into (Non-embedded) tomcat and for tomcat to apply java modules concepts on it?

I am thinking its NOT possible currently as of today for following reasons.

  1. it is actually catalina.jar which is getting launched by Java in catalina.bat or .sh and it will have to in turn load the modules. I could not see any such concept inside org.apache.catalina.loader.WebappLoader, WebappClassLoader or WebappClassLoaderBase in same package. I might be mistaken of course.
  2. I think we can create the .war project using module concepts. Have the modular restrictions enforced during code creation and compilation time if we have a module-info.java created. But all those extra checks will be not applied when application is running in tomcat. Those extra checks might of course keep the libraries inside WEB-INF/lib more efficiently organized during development.

I do realize we could easily leverage java modules when using embedded tomcat as long as you launch the code as a jar project with all needed dependencies and use --module-path.

R

Raster R
  • 267
  • 1
  • 11
  • 1
    You can take a look at this answer: https://stackoverflow.com/questions/46618118/web-inf-lib-directory-vs-java-9-modules/66587371#66587371 – Thiago Henrique Hupner Sep 25 '21 at 14:19
  • @Thiago Henrique Hupner I have seen this. I am still waiting for someone to agree or disagree with what I have said – Raster R Sep 26 '21 at 16:28

0 Answers0