You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Payara(GlassFish)服务器外置Domain可行性及配置路径咨询

答案:将Payara/GlassFish Domain移至安装目录外部的可行方案

Absolutely yes! You can move your Payara/GlassFish domains completely outside the Payara installation directory — this is actually a recommended best practice for exactly the scenario you described: avoiding domain configuration loss or conflicts during server upgrades. Below is a step-by-step guide to make this work:

一、First, manually migrate your existing Domain folders

  1. Stop all running domains first to avoid file locks:
    asadmin stop-domain domain1
    asadmin stop-domain payaraDomain
    
  2. Copy the entire domain folders (like payara/glassfish/domains/domain1 and payara/glassfish/domains/payaraDomain) to your external target directory, e.g., /opt/payara-domains/. Make sure to preserve the original file permissions to avoid startup permission issues later.
  3. You can delete the original domain folders under the Payara installation directory (or back them up first to prevent accidental misloading).

二、Configure Payara to point to the external Domain location

There are two common methods to specify the external domain path — pick the one that fits your workflow:

Method 1: Specify the domain path via asadmin command on startup

Each time you start a domain, use the --domaindir parameter to point to the external directory:

asadmin start-domain --domaindir /opt/payara-domains/ domain1
asadmin start-domain --domaindir /opt/payara-domains/ payaraDomain

This method is great for temporary testing or if you don't want to modify global configurations.

Method 2: Modify global config to permanently set the default domain directory

If you want all asadmin commands to automatically read domains from the external directory by default:

  1. Locate the configuration file: glassfish/config/asenv.conf (Linux/macOS) or glassfish/config/asenv.bat (Windows) in your Payara installation folder.
  2. Add or modify the following line:
    • For Linux/macOS:
      AS_DOMAINS_DIR=/opt/payara-domains/
      
    • For Windows:
      set AS_DOMAINS_DIR=C:\payara-domains\
      
  3. After saving the config, all subsequent asadmin commands (like start-domain, list-domains) will default to the external directory, no need to specify the parameter every time.

三、Verify the configuration works

  1. Run asadmin list-domains — you should see domain1 and payaraDomain from the external directory, marked as not running.
  2. Start one domain (e.g., asadmin start-domain domain1) and check if the server launches successfully. Test your application to confirm everything works as expected.
  3. Now you can safely upgrade Payara: just replace the original installation directory files. The external domains won't be touched at all, and you can start them with the same configuration after the upgrade.

Extra Notes

  • Ensure correct permissions for the external domain directory: the user running Payara needs full read/write access to this folder, otherwise you'll get permission errors on startup.
  • If your domain uses custom resource paths (like JDBC pool file paths, custom library locations), check if they're relative paths. If so, adjust them to absolute paths pointing to the correct external locations.

内容的提问来源于stack exchange,提问作者Nallamachu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:49:51