指示Wildfly将应用程序作为模块化应用程序运行(Java 9模块) [英] Instruct Wildfly to run an application as a modular application (Java 9 modules)

查看:110
本文介绍了指示Wildfly将应用程序作为模块化应用程序运行(Java 9模块)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用:

  • Wildfly 21
  • Java 11

我刚刚经历了在Wildfly 21上运行的我的 Jakarta EE EAR 应用程序的模块化(使用Java 9模块)的痛苦. war jar, ejb jar,实用程序jar(现在都具有 module-info.java )和其他第三方库.整个应用程序编译良好,没有错误.

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.

但是我注意到,当我在Wildfly中运行它时,尽管它没有像以前那样在没有模块化的情况下运行时没有问题,但似乎应用服务器没有考虑到它现在是模块化应用程序,并且没有使用modulepath运行应用程序,但使用类路径.因此,在运行时,将忽略应用程序的模块化性质.

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.

是否可以使用 modulepath 而不是classpath指示应用程序服务器以模块化方式运行应用程序?

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

很遗憾,我们必须被Wildfly之类的应用服务器锁定,阻止我们在应用程序运行时使用如此重要的Java功能(模块).

推荐答案

虽然Wildfly不支持运行模块化战争,但您可以看看Piranha Cloud.

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

Piranha Server本身可以在模块路径中运行,并且可以按照提供的module-info.class在新的JPMS层中部署WAR.

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:我是Piranha Cloud开发人员

PS: I'm a Piranha Cloud developer

这篇关于指示Wildfly将应用程序作为模块化应用程序运行(Java 9模块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆