Search code examples
javanetbeansglassfishpayara

Payara 5.2022.2 Can not deploy modules to context-root /


Environment details:

Payara 5.2022.2
Windows Server 2019 Enterprise LTSC
Apache Netbeans 14
JDK 17

This is the only machine and environment that produces this error when I try to deploy the same program to it:

The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 4 seconds)
SEVERE:   Exception while loading the app
SEVERE:   Exception while loading the app : java.lang.Exception: Virtual server __asadmin already has a web module __admingui loaded at / therefore web module OIUSA_1 cannot be loaded at this context path on this virtual server

From other questions I have gathered that something is wrong with the server-config->Virtual Servers config of Payara, so here are two photos showing the only discernable difference between a working install of Payara, and the Windows Server that gives an error:

Working server: Working server enviornemnt Working server enviornemnt2

Not working server: Broken server enviornemnt Broken server enviornemnt2

So, the virtual server named server in the WORKING installation of Payara has a context path of / but the non working version doesn't. I'm not sure how to fix this, since I have tried fully uninstalling, rebooting, and re-installing.


Solution

  • I came up with a solution:

    In the glassfish-web.xml of the application configuration set the Context Root = /your_project_name

    Then, deploy the application like expected and it should come up. Then enter the admin domain console and navigate to configurations->server-config->virtual servers-> then select the virtual server your application is running on and set the Default Web Module to your application. This will give the same result of running the application in the root folder (/). No deleting stuff from configuration files needed.