Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: AS_JAVA ignored for start-domain #5210

Closed
mkarg opened this issue Apr 23, 2021 · 4 comments
Closed

Bug Report: AS_JAVA ignored for start-domain #5210

mkarg opened this issue Apr 23, 2021 · 4 comments
Labels
Type: Enhancement Label issue as an enhancement request

Comments

@mkarg
Copy link
Contributor

mkarg commented Apr 23, 2021

Description


I noticed that (at least on Windows 10 using latest Payara Community Edition) when executing SET AS_JAVA=xxx followed by asadmin on the command line, then apparently asadmin itself is running on that particular JVM, while actually the particular command start-domain still uses the JVM located by JAVA_HOME instead. If I want start-domain to use AS_JAVA, then I must additionally add it into asenv.bat.

@rdebusscher asked me to file this issue in the Community forum.

Expected Outcome

start-domain uses the JVM defined by AS_JAVA already existing in environment before executing asadmin.

Current Outcome

asadmin itself is running on the JVM found in AS_JAVA in the environment before executing asadmin, but start-domain still uses the JVM located by JAVA_HOME instead

Steps to reproduce

  • Do not set AS_JAVA in asenv.bat.
SET AS_JAVA=<path-one>
SET JAVA_HOME=<path-two>
asadmin start-domain

asadmin will use <path-one> but start-domain will use <path-two>.

Environment

  • Distribution: Payara Full Server Community Edition 5.2021.2
  • JDK Version: Java 8 (Azul Zulu)
  • Operating System: Windows 10 (64 Bit)
@mkarg mkarg added the Type: Bug Label issue as a bug defect label Apr 23, 2021
@avpinchuk
Copy link
Contributor

I think this is not a bug.

This behavior is consistent with at least GlassFish 5 and GlassFish 6.

See administration guide

@mkarg
Copy link
Contributor Author

mkarg commented Apr 23, 2021

I think this is not a bug.

This behavior is consistent with at least GlassFish 5 and GlassFish 6.

See administration guide

That might be the case. But the question is whether the documented behavior is intentional, i. e. whether the authors of Payara do really want it to be this way, or whether they would say it might be beneficial to actually use the existing value of AS_JAVA given upfront already.

@OndroMih OndroMih added Type: Enhancement Label issue as an enhancement request and removed Type: Bug Label issue as a bug defect labels Jun 29, 2021
@OndroMih
Copy link
Contributor

In Linux, the AS_JAVA variable is taken into account and Payara Server is started on the JVM specified by it. So it might be a bug on Windows or a limitation of environment variables on Windows.

Unfortunately, I really don't think we can consider changing this in a foreseeable future as it's a rather edge case. If you find out how to fix it, feel free to raise a PR and we'll gladly accept it. Until then, I'll close this issue, I hope you understand.

@OndroMih
Copy link
Contributor

Actually, I realized that what you do isn't supported and it's not meant to be supported. To launch Payara Server with a JVM specified using AS_JAVA, the AS_JAVA variable needs to be specified in asenv.bat (or asenv.conf in Linux). This file is parsed for properties that are used to start the server. This is specified in the GlassFish documentation and Payara doesn't intend to change this. GlassFish Administration guide says: "For a valid JVM installation, locations are checked in the following order: a. domain.xml (java-home inside java-config) b. asenv.conf (setting AS_JAVA="path to java home")" It doesn't say anything about setting AS_JAVA as an environment variable.

It's true that the asadmin script honours the AS_JAVA environment variable. This is an implementation detail. It just runs the asenv script, which sets the env variable and then the script uses it. But Payara Server launcher, which is started by this script, doesn't honour AS_JAVA env variable. Instead, it reads the asenv file as a text file and reads the variables from there:

I'm sorry, but we're not going to change this in Payara Server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Label issue as an enhancement request
Projects
None yet
Development

No branches or pull requests

3 participants