Instruct Wildfly to run an application as a modular application (Java 9 modules)
Asked Answered
R

1

0

I'm using:

  • Wildfly 21
  • Java 11

I've just went through the pain of modularizing (with Java 9 modules) an Jakarta EE EAR application of mine that runs on Wildfly 21. This application has a war jar, ejb jars, utility jars (all have a module-info.java now) and other third party libraries. The whole application compiles well, without errors.

But I noticed that when I run it in Wildfly, althought it runs without problems as before when it wasn't modular, it seems that the application server is not considering that it is now a modular application and is not using the modulepath to run the application, but the classpath. So, at runtime, the modular nature of the application is being ignored.

Is there a way to instruct the application server to run the application as a modular one, using the modulepath instead of the classpath?

It's a pity that we have to be locked by application servers like Wildfly blocking us from using such an important Java feature (modules) at runtime in our applications.

Rectal answered 12/2, 2021 at 19:52 Comment(2)
This is duplicate of #46497672Sims
@TomazCerar Thanks for the reference. There's something similar here too: #58737969 . I also got an official answer from the Wildfly guys: groups.google.com/g/wildfly/c/lTj1suvUpYgRectal
R
0

While Wildfly doesn't support running modular wars, you can take a look at Piranha Cloud.

The Piranha Server itself can run in the module path and can deploy WARs in a new JPMS layer, respecting the module-info.class provided.

https://piranha.cloud/blog/2021/20210128_Modular_applications_with_JPMS

PS: I'm a Piranha Cloud developer

Rijeka answered 25/2, 2021 at 11:56 Comment(2)
What about EARs? My application is an EAR.Rectal
Currently we don't support EAR. But maybe you could try to move the EJBs to the WAR. It is supported since Java EE 6Rijeka

© 2022 - 2024 — McMap. All rights reserved.