Open troy-bishop opened 2 years ago
See line:
[2021-11-30, 10:40:51:557 EST] 00000038 com.ibm.ws.javaee.ddmodel.webext.WebExtAdapter E CWWKC2277E: One or more module names on the web-ext element are invalid. The invalid module name or names are [zdt-restapi, zdt-webui].
I can confirm.
It looks like this error was removed altogether fairly recently (it probably won't be in a release until 22.0.0.1). That resolves the issue you were seeing, but means that there will not be an error message for an invalid module name if application.xml doesn't exist. I'm going to use this issue to add back the error in a way that also works in your scenario.
The problem of validating module names is exposed in the web binding adapter:
dev/com.ibm.ws.javaee.ddmodel/src.gen/com/ibm/ws/javaee/ddmodel/webbnd/WebBndAdapter.java dev/com.ibm.ws.javaee.ddmodel/src.gen/com/ibm/ws/javaee/ddmodel/common/BndExtAdapter.java
There is a problem in that when no application descriptor is available, the modules list is computed. See:
DeployedAppInfoBase.moduleContainerInfos
EARDeployedAppInfo.createModuleContainerInfo
SimpleDeployedAppInfoBase.preDeployApp
SimpleDeployedAppInfoBase$ModuleContainerInfoBase.createModuleMetaData
ModuleHandlerBase.createModuleMetaData
The computed modules list is not currently available to the web bnd adapter.
This looks like a medium fix.
There is a problem that the validation of module names requires steps not immediately accessible to the bindings and extensions processing. The problem is that when no application.xml is present, the modules list must be computed before the module names can be obtained. Determining modules is a complex process done away from the bindings and extensions processing.
See comments on: open-liberty/dev/com.ibm.ws.javaee.ddmodel/src.gen/com/ibm/ws/javaee/ddmodel/common/BndExtAdapter.java
// TFB:
//
// Retrieval of module names, as implemented, is unreliable.
// The implementation relies on the application descriptor, which
// may be absent.
//
// The completed modules list is computed by the deployed application. See:
//
// open-liberty/dev/com.ibm.ws.app.manager.module/src/
// com/ibm/ws/app/manager/module/internal/
// DeployedAppInfoBase.java
// SimpleDeployedAppInfoBase.java
//
// open-liberty/dev/com.ibm.ws.app.manager.war/src/
// com/ibm/ws/app/manager/ear/internal/
// EARDeployedAppInfo.java
//
// In particular, see:
// DeployedAppInfoBase.moduleContainerInfos
// EARDeployedAppInfo.createModuleContainerInfo
//
// SimpleDeployedAppInfoBase.preDeployApp
// SimpleDeployedAppInfoBase$ModuleContainerInfoBase.createModuleMetaData
// ModuleHandlerBase.createModuleMetaData
//
// The current implementation fails with a NullPointerException for an application which
// does not have a application deployment descriptor (META-INF/application.xml):
//
// Stack Dump = java.lang.NullPointerException
// at com.ibm.ws.javaee.ddmodel.common.BndExtAdapter.getModuleNames(BndExtAdapter.java:369)
...
// at com.ibm.ws.app.manager.ear.internal.EARApplicationHandlerImpl.install(EARApplicationHandlerImpl.java:77)
// at com.ibm.ws.app.manager.internal.statemachine.StartAction.execute(StartAction.java:149)
// at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.enterState(ApplicationStateMachineImpl.java:1352)
//
// A correct implementation would provide the complete modules list. That would introduce a new type
// and new dependencies, and is not done at this time.
Kernel Assessment Medium. See: https://github.com/OpenLiberty/open-liberty/issues/19510#issuecomment-2015384407
Describe the bug
It looks like there’s a bug that causes the CWWKC2277E error message to be emitted when there is no application.xml, there are multiple web modules, and at least one of the modules doesn’t have a web-ext override in server.xml.. The web-ext overrides are picked up, though.
Steps to Reproduce
Create an EAR (with no application.xml) that has 2 web modules where the context-root is overridden in the server.xml via the web-ext property, example:
EAR (zdt-mc) contains 2 web modules: zdt-restapi.war and zdt-webui.war.
The server does bind the context-root TEST to zdt-webui but still emits the CWWKC2277E error message.
Expected behavior
No CWWKC2277E error message emitted when starting the server with this application.
Diagnostic information:
server.xml configuration (WITHOUT sensitive information like passwords)
$WLP_OUTPUT_DIR/messages.log
Additional context
N/A