Skip to content

Create Domain is not using symbolic link values as they're being passed #1591

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

Closed
wicketr opened this issue Nov 13, 2024 · 12 comments
Closed

Comments

@wicketr
Copy link

wicketr commented Nov 13, 2024

Using WebLogic Deploy Tooling 4.2.1
Script: createDomain.sh

We are trying to use symbolic link names to our Weblogic directory and our Java directory. We're passing that to the createDomain.sh script, however these symbolic links are getting resolved to the actual paths. This is causing headaches when Weblogic and Java updates are getting added, and EOL patches removed.

example:

-oracle_home /opt/app/weblogic
-java_home /opt/app/java

I'm even trying to set JAVA_HOME directly in advance, but it's still getting resolved to the actual path when it generates all the scripts.

In all the domain/bin scripts, like setDomainEnv.sh, the values are set to:

WL_HOME="/opt/weblogic/wl12214_241015/wlserver"
JAVA_HOME="/opt/java/hotspot/8/64_bit/jdk1.8.0_431"

As newer versions of Java and Weblogic patches are released, these old versions are removed from our servers as we get new patched versions of Weblogic and Java, and we're left with a domain that no longer starts when the old versions are eventually removed from our servers (typically only have latest 6 months of versions).

If I'm setting specific paths for these values, shouldn't it being using those specific paths? That would allow us to keep our symbolic link pointed to the latest patches without having to modify a dozen scripts every few months.

@robertpatrick
Copy link
Member

@wicketr I don't think this is a WDT issue. Try creating a domain with the Config Wizard or WLST offline to see what paths are baked into the Domain scripts...

@wicketr
Copy link
Author

wicketr commented Nov 14, 2024

Seems to be mixed bag. Weblogic home is resolving to actual, but java home is remaining the symbolic link.

Running this command:

/opt/app/weblogic/oracle_common/common/bin/unpack.sh -template=/opt/app/weblogic/wlserver/common/templates/wls/wls.jar -java_home=/opt/app/java -server_start_mode=prod -domain=/opt/app/domain/testA -user_name=test -password=test123 -log=/var/app/logs/weblogic/server_create.log

Console output:

Warning: Option "-password" is deprecated. Use "-walletDir" to specify wallet where pw is stored.
<< read template from "/opt/weblogic/wl12214_241015/wlserver/common/templates/wls/wls.jar"
>>  succeed: read template from "/opt/weblogic/wl12214_241015/wlserver/common/templates/wls/wls.jar"
<< set config option JavaHome to "/opt/app/java"
>>  succeed: set config option JavaHome to "/opt/app/java"
<< set config option ServerStartMode to "prod"
>>  succeed: set config option ServerStartMode to "prod"
<< find Security "base_domain" as obj0
<< create User "test" as obj1
>>  succeed: create User "test" as obj1
<< find Security "base_domain" as obj2
<< find Security "base_domain" as obj3
<< find Security!User "base_domain!test" as obj4
>>  succeed: find Security!User "base_domain!test" as obj4
<< set obj1 attribute Password to "********"
>>  succeed: set obj1 attribute Password to "********"
<< set obj1 attribute IsDefaultAdmin to "true"
>>  succeed: set obj1 attribute IsDefaultAdmin to "true"
>>  validateConfig "KeyStorePasswords"
>>  succeed: validateConfig "KeyStorePasswords"
<< write Domain to "/opt/app/domain/testA"
..................................................
>>  succeed: write Domain to "/opt/app/domain/testA"
<< close template
>>  succeed: close template
Finished creating domain.

All the scripts in the domain/bin are:

WL_HOME="/opt/weblogic/wl12214_241015/wlserver"
JAVA_HOME="/opt/app/java"

@robertpatrick
Copy link
Member

@wicketr OK, so it might be that WDT is doing something (e.g., java.io.File.getCanonicalPath()) that somehow changes the JAVA_HOME but I assume you realize that WDT does not use unpack so your results may not be completely consistent. Clearly, the WL_HOME value indicates that WDT isn't the one resolving this to the actual directory name.

Another thing you might want to look is the following:

rpatrick@rpatrick-mac tmp % export MW_HOME=/tmp/jrf1412 
rpatrick@rpatrick-mac tmp % export JAVA_HOME=/tmp/jdk17 
rpatrick@rpatrick-mac tmp % export WL_HOME=/tmp/jrf1412/wlserver
rpatrick@rpatrick-mac tmp % export ORACLE_HOME=/tmp/jrf1412/oracle_common 
rpatrick@rpatrick-mac tmp % wlst.sh env.py                             

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

WL_HOME = /opt/weblogic/jrf1412/wlserver
MW_HOME = /opt/weblogic/jrf1412
JAVA_HOME = /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
ORACLE_HOME = /opt/weblogic/jrf1412/oracle_common
rpatrick@rpatrick-mac tmp % 

As you can see, running wlst.sh causes all of these environment variables set to point to a path that contains a symbolic link to be reset. The env.py script is shown below

import os

env_var_names = ['ORACLE_HOME', 'WL_HOME', 'MW_HOME', 'JAVA_HOME']

for key, value in os.environ.items():
    if key in env_var_names:
        print(str(key) + ' = ' + str(value))

In this case, the wlst.sh and supporting shell scripts are all from the OUI installer created Middleware Home directory. If WLST is resetting these values to the ones used to run the installer, there isn't much we can do at the WDT level. Maybe try running the installer using the symbolic links to see if that makes any difference?

@robertpatrick
Copy link
Member

@wicketr In looking more at the WDT code, it seems like -java_home <symlink-path> is already calling WLST setOption('JavaHome', <java-home-path>) which in theory, is the Public API for creating domains using a different Java Home than the one being used to run the tool.

I guess we need to figure out if the value passed using the -java_home command line argument is making it through to the setOption() call or if WDT is somehow causing the real path to replace it. We need to look at two things in the createDomain.log file:

  1. At the top of the log file, the value passed for the -java_home as reported by WDT.
  2. The value that the WlstHelper set_option() function received for the JavaHome setting.

In my environment (where I did not pass in -java_home), I see this:

...
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <ENTRY /Users/rpatrick/tmp/jrf/weblogic-deploy/lib/python/create.py>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[0] = /Users/rpatrick/tmp/jrf/weblogic-deploy/lib/python/create.py>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[1] = -oracle_home>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[2] = /opt/weblogic/soa12214>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[3] = -domain_parent>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[4] = /Users/rpatrick/tmp/jrf>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[5] = -model_file>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[6] = model.yaml>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[7] = -run_rcu>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[8] = -domain_type>
####<Nov 13, 2024 3:29:21 PM> <FINER> <create> <main> <> <sys.argv[9] = JRF>

...

####<Nov 13, 2024 3:36:12 PM> <FINER> <WlstHelper> <set_option> <> <ENTRY JavaHome /Library/Java/JavaVirtualMachines/jdk1.8.0_351.jdk/Contents/Home>

Can you show me the log entries corresponding to the -java_home command-line argument and the value that the WlstHelper set_option() function sees for the JavaHome?

@wicketr
Copy link
Author

wicketr commented Nov 14, 2024

Here's parameters part:


####<Nov 13, 2024 9:00:54 PM> <FINER> <create> <main> <> <sys.argv[0] = /opt/app/test/yaml/weblogic-deploy/lib/python/create.py>
####<Nov 13, 2024 9:00:54 PM> <FINER> <create> <main> <> <sys.argv[1] = -oracle_home>
####<Nov 13, 2024 9:00:54 PM> <FINER> <create> <main> <> <sys.argv[2] = /opt/app/weblogic/>
####<Nov 13, 2024 9:00:54 PM> <FINER> <create> <main> <> <sys.argv[3] = -domain_parent>
####<Nov 13, 2024 9:00:54 PM> <FINER> <create> <main> <> <sys.argv[4] = /opt/app/domain/>
####<Nov 13, 2024 9:00:54 PM> <FINER> <create> <main> <> <sys.argv[5] = -java_home>
####<Nov 13, 2024 9:00:54 PM> <FINER> <create> <main> <> <sys.argv[6] = /opt/app/java>
####<Nov 13, 2024 9:00:54 PM> <FINER> <create> <main> <> <sys.argv[7] = -model_file>
####<Nov 13, 2024 9:00:54 PM> <FINER> <create> <main> <> <sys.argv[8] = model.yaml>
####<Nov 13, 2024 9:00:54 PM> <FINER> <EncryptionUtils> <isEncryptionSupported> <> <ENTRY>
####<Nov 13, 2024 9:00:55 PM> <FINER> <EncryptionUtils> <isEncryptionSupported> <> <RETURN true>
####<Nov 13, 2024 9:00:55 PM> <INFO> <create> <main> <WLSDPLY-20044> </opt/app/test/yaml/weblogic-deploy/lib/python/create.py is running on a Java version that supports the encryption algorithms used by WDT encryption>

Later on regarding the oracle home I see this as well as the other paths being resolved to actuals instead of symbolics. The last line in this log shows all actual paths.

####<Nov 13, 2024 9:00:55 PM> <FINER> <CommandLineArgUtil> <process_args> <> <ENTRY ['/opt/app/test/yaml/weblogic-deploy/lib/python/create.py', '-oracle_home', '/opt/app/weblogic/', '-domain_parent', '/opt/app/domain/', '-java_home', '/opt/app/java', '-model_file', 'model.yaml']>
####<Nov 13, 2024 9:00:55 PM> <FINE> <CommandLineArgUtil> <process_args> <WLSDPLY-01600> <Processing command-line argument -oracle_home>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateExistingDirectory> <> <ENTRY /opt/app/weblogic/>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateDirectoryName> <> <ENTRY /opt/app/weblogic/>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <ENTRY /opt/app/weblogic/ WLSDPLY-01110>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <RETURN /opt/weblogic/wl12214_241015>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateDirectoryName> <> <RETURN /opt/weblogic/wl12214_241015>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateExistingDirectory> <> <RETURN /opt/weblogic/wl12214_241015>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateExistingDirectory> <> <ENTRY /opt/weblogic/wl12214_241015/wlserver>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateDirectoryName> <> <ENTRY /opt/weblogic/wl12214_241015/wlserver>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <ENTRY /opt/weblogic/wl12214_241015/wlserver WLSDPLY-01110>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <RETURN /opt/weblogic/wl12214_241015/wlserver>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateDirectoryName> <> <RETURN /opt/weblogic/wl12214_241015/wlserver>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateExistingDirectory> <> <RETURN /opt/weblogic/wl12214_241015/wlserver>
####<Nov 13, 2024 9:00:55 PM> <FINE> <CommandLineArgUtil> <process_args> <WLSDPLY-01600> <Processing command-line argument -domain_parent>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateWritableDirectory> <> <ENTRY /opt/app/domain/>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateDirectoryName> <> <ENTRY /opt/app/domain/>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <ENTRY /opt/app/domain/ WLSDPLY-01110>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <RETURN /opt/app/domain>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateDirectoryName> <> <RETURN /opt/app/domain>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateWritableDirectory> <> <RETURN /opt/app/domain>
####<Nov 13, 2024 9:00:55 PM> <FINE> <CommandLineArgUtil> <process_args> <WLSDPLY-01600> <Processing command-line argument -java_home>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateExistingDirectory> <> <ENTRY /opt/app/java>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateDirectoryName> <> <ENTRY /opt/app/java>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <ENTRY /opt/app/java WLSDPLY-01110>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <RETURN /opt/java/hotspot/8/64_bit/jdk1.8.0_431>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateDirectoryName> <> <RETURN /opt/java/hotspot/8/64_bit/jdk1.8.0_431>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateExistingDirectory> <> <RETURN /opt/java/hotspot/8/64_bit/jdk1.8.0_431>
####<Nov 13, 2024 9:00:55 PM> <FINE> <CommandLineArgUtil> <process_args> <WLSDPLY-01600> <Processing command-line argument -model_file>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateFileName> <> <ENTRY model.yaml>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <ENTRY model.yaml WLSDPLY-01108>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validatePathyNameInternal> <> <RETURN /opt/app/test/yaml/model.yaml>
####<Nov 13, 2024 9:00:55 PM> <FINER> <FileUtils> <validateFileName> <> <RETURN /opt/app/test/yaml/model.yaml>
####<Nov 13, 2024 9:00:55 PM> <FINER> <CommandLineArgUtil> <process_args> <> <RETURN {'-trailing_arguments': [], '-domain_parent': '/opt/app/domain', '-java_home': '/opt/java/hotspot/8/64_bit/jdk1.8.0_431', '-oracle_home': '/opt/weblogic/wl12214_241015', '-model_file': '/opt/app/test/yaml/model.yaml'}>

@robertpatrick
Copy link
Member

robertpatrick commented Nov 14, 2024

@wicketr As for the Java Home, please provide the other log entry requested so that I can see what, if anything, may need to be changed for this to work.

The -oracle_home argument is completely different. It is really of limited use in WDT; for example:

  • knowing where to find executables like rcu or wlst.sh
  • tokenizing/detokenizing model paths
  • knowing which binaries to collect versus assume will be present in the new environment.

There is no WLST Public API that allows us to specify the the Oracle Home to be used to create the domain--it is always the one from which wlst.sh is running ( and the path is determined by WLST itself). As such, I do not believe that there is any WDT fix that can help you.

@wicketr
Copy link
Author

wicketr commented Nov 14, 2024

I'm seeing this for the JavaHome:

####<Nov 14, 2024 10:49:34 PM> <FINER> <WlstHelper> <set_option> <> <ENTRY JavaHome /opt/java/hotspot/8/64_bit/jdk1.8.0_431>

As an aside, Isn't WLST also owned by Oracle? Figure someone in the company should be made aware of this problem and fix the "private" implementation. Allowing the WDT appropriately interface with it would help us all.

For now, I'm just going to create my own "bin" scripts, that are generic and allow me to pass in the appropriate WL_HOME and JAVA_HOME without them getting overwritten.

@robertpatrick
Copy link
Member

@wicketr yes, of course WLST is part of WebLogic Server, which itself is the foundation for the rest of Fusion Middleware. The issue is that this removal of the symbolic links from the paths is likely intentional so changing that behavior is not something that is easy to do. If you feel strongly about this, I would encourage you to file an SR with Oracle Support as customer-driven change requests get the highest level of consideration.

@robertpatrick
Copy link
Member

robertpatrick commented Nov 18, 2024

@wicketr I did two things:

  • I reinstalled my Oracle Home using the symbolic links to run and configure the installer.
  • I made a change inside WDT to not remove the symbolic links by default.

After doing that, running the env.py script shows the Oracle Home-related symlinks inside of WLST are being used.

WL_HOME = /tmp/jrf1412/wlserver
MW_HOME = /tmp/jrf1412
JAVA_HOME = /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
ORACLE_HOME = /tmp/jrf1412/oracle_common

When I run WDT, I no longer see any conversion of the symlinks inside WDT.

####<Nov 18, 2024 11:03:31 AM> <FINE> <CommandLineArgUtil> <process_args> <WLSDPLY-01600> <Processing command-line argument -oracle_home>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateExistingDirectory> <> <ENTRY /tmp/jrf1412>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateDirectoryName> <> <ENTRY /tmp/jrf1412>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validatePathNameInternal> <> <ENTRY /tmp/jrf1412 WLSDPLY-01110>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validatePathNameInternal> <> <RETURN /tmp/jrf1412>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateDirectoryName> <> <RETURN /tmp/jrf1412>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateExistingDirectory> <> <RETURN /tmp/jrf1412>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateExistingDirectory> <> <ENTRY /tmp/jrf1412/wlserver>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateDirectoryName> <> <ENTRY /tmp/jrf1412/wlserver>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validatePathNameInternal> <> <ENTRY /tmp/jrf1412/wlserver WLSDPLY-01110>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validatePathNameInternal> <> <RETURN /tmp/jrf1412/wlserver>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateDirectoryName> <> <RETURN /tmp/jrf1412/wlserver>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateExistingDirectory> <> <RETURN /tmp/jrf1412/wlserver>
####<Nov 18, 2024 11:03:31 AM> <FINE> <CommandLineArgUtil> <process_args> <WLSDPLY-01600> <Processing command-line argument -java_home>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateExistingDirectory> <> <ENTRY /tmp/jdk17>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateDirectoryName> <> <ENTRY /tmp/jdk17>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validatePathNameInternal> <> <ENTRY /tmp/jdk17 WLSDPLY-01110>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validatePathNameInternal> <> <RETURN /tmp/jdk17>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateDirectoryName> <> <RETURN /tmp/jdk17>
####<Nov 18, 2024 11:03:31 AM> <FINER> <FileUtils> <validateExistingDirectory> <> <RETURN /tmp/jdk17>

...

####<Nov 18, 2024 11:03:35 AM> <FINER> <WlstHelper> <set_option> <> <ENTRY JavaHome /tmp/jdk17>

...

Unfortunately, creating the domain does not exclusively use the symlinks in the setDomainEnv.sh script:

WL_HOME="/opt/weblogic/jrf1412/wlserver"
export WL_HOME

BEA_JAVA_HOME=""
export BEA_JAVA_HOME

DEFAULT_BEA_JAVA_HOME=""
export DEFAULT_BEA_JAVA_HOME

SUN_JAVA_HOME="/tmp/jdk17"
export SUN_JAVA_HOME

DEFAULT_SUN_JAVA_HOME="/tmp/jdk17"
export DEFAULT_SUN_JAVA_HOME

Assuming the WDT change doesn't break anything in our integration tests, I will go ahead and commit the change. However, this will not solve all of your Oracle Home-related challenges.

@wicketr
Copy link
Author

wicketr commented Nov 18, 2024

It's at least a step closer! Thanks for looking into this!

Yea, until the other one is fixed from the other team, I'll likely use my custom bin folder of scripts, so I'm fully dynamic. Thanks again.

@robertpatrick
Copy link
Member

@wicketr The other one won't be fixed unless/until customers file an SR asking for it to be changed...

@robertpatrick robertpatrick self-assigned this Nov 18, 2024
@robertpatrick
Copy link
Member

The WDT change discussed is now in the main branch. We will release in the next month or so,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants