Skip to content

Commit eaa5ed3

Browse files
authored
Merge pull request #1117 from oracle/owls-70496
Start WLS with -Dweblogic.SituationalConfig.failBootOnError=true
2 parents 657afa9 + ab67409 commit eaa5ed3

File tree

6 files changed

+73
-8
lines changed

6 files changed

+73
-8
lines changed

docs-source/content/userguide/managing-domains/configoverrides/_index.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,12 @@ spec:
336336
---
337337
### Debugging
338338
339-
Incorrectly formatted override files may be accepted without warnings or errors and will not prevent WebLogic pods from booting. So, it is important to make sure that the template files are correct in a QA environment, otherwise your WebLogic Servers may start even though critically required overrides are failing to take effect.
339+
Incorrectly formatted override files may be accepted without warnings or errors and may not prevent WebLogic pods from booting. So, it is important to make sure that the template files are correct in a QA environment, otherwise your WebLogic Servers may start even though critically required overrides are failing to take effect.
340+
341+
On WebLogic Servers that support the `weblogic.SituationalConfig.failBootOnError` system property ( Note: It is not supported in WebLogic Server 12.2.1.3.0 ),
342+
by default the WebLogic server will fail to boot if any situational configuration files are invalid,
343+
or if it encounters an error while loading situational configuration files.
344+
By setting the `FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR` environment variable in the Kubernetes containers for the WebLogic Servers to `false`, you can start up the WebLogic Servers even with incorrectly formatted override files.
340345
341346
* Make sure you've followed each step in the [Step-by-step guide](#step-by-step-guide).
342347
@@ -363,9 +368,17 @@ Incorrectly formatted override files may be accepted without warnings or errors
363368
...
364369
```
365370
* Look in your `DOMAIN_HOME/optconfig` directory.
366-
* This directory, or a subdirectory within this directory, should contain each of your custom situational configuration files.
367-
* If it doesn't, then this likely indicates your domain resource `configOverrides` was not set to match your custom override configuration map name, or that your custom override configuration map does not contain your override files.
368-
371+
* This directory, or a subdirectory within this directory, should contain each of your custom situational configuration files.
372+
* If it doesn't, then this likely indicates your domain resource `configOverrides` was not set to match your custom override configuration map name, or that your custom override configuration map does not contain your override files.
373+
374+
* If the Administration Server pod does start but fails to reach ready state or tries to restart:
375+
* Check for this message ` WebLogic server failed to start due to missing or invalid situational configuration files` in the Administration Server pod's `kubectl log`
376+
* This suggests that the Administration Server failure to start may have been caused by errors found in a configuration override file.
377+
* Lines containing the String `situational` may be found in the Administration Server pod log to provide more hints.
378+
* For example:
379+
* `<Jun 20, 2019 3:48:45 AM GMT> <Warning> <Management> <BEA-141323> <The situational config file has an invalid format, it is being ignored: XMLSituationalConfigFile[/shared/domains/domain1/optconfig/jdbc/testDS-0527-jdbc-situational-config.xml] because org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 3; The element type "jdbc:jdbc-driver-params" must be terminated by the matching end-tag "</jdbc:jdbc-driver-params>".`
380+
* The warning message suggests a syntax error is found in the provided configuration override file for the testDS JDBC datasource.
381+
369382
* If you'd like to verify that the situational configuration is taking effect in the WebLogic MBean tree, then one way to do this is to compare the `server config` and `domain config` MBean tree values.
370383
* The `domain config` value should reflect the original value in your domain home configuration.
371384
* The `server config` value should reflect the overridden value.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
4+
# Licensed under the Universal Permissive License v 1.0 as shown at
5+
# http://oss.oracle.com/licenses/upl.
6+
7+
#
8+
# This script is used to monitor the server log until the server is
9+
# started successfully.
10+
# It is separate from startServer.sh so that it is easier to quickly
11+
# kill the process running this script.
12+
#
13+
14+
echo $$ > /tmp/monitorLog-pid
15+
16+
SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
17+
source ${SCRIPTPATH}/traceUtils.sh
18+
19+
trace "Monitoring server log file $1 every $2 seconds for selected known log messages."
20+
21+
while true; do
22+
if grep -q "BEA-141335" $1 ; then
23+
msg=("WebLogic server failed to start due to missing or invalid"
24+
"situational configuration files, which may be due to invalid"
25+
"configOverride templates (these are specified via the"
26+
"configOverride attribute in the Domain custom resource)."
27+
"For details, please search your pod log or"
28+
"${SERVER_OUT_FILE} for the keyword 'situational'."
29+
)
30+
trace "${msg[*]}"
31+
exit 0
32+
fi
33+
if grep -q "BEA-000360" $1 ; then
34+
trace "WebLogic Server started successfully."
35+
exit 0
36+
fi
37+
sleep $2
38+
done
39+

operator/src/main/resources/scripts/startNodeManager.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
# Default:
2828
# Use LOG_HOME. If LOG_HOME not set, use NODEMGR_HOME.
2929
# ADMIN_PORT_SECURE = "true" if the admin protocol is secure. Default is false
30+
# FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR = "true" if WebLogic server should fail to
31+
# boot if situational configuration related errors are
32+
# found. Default to "true" if unspecified.
3033
#
3134
# If SERVER_NAME is set, then this NM is for a WL Server and these must also be set:
3235
#
@@ -113,12 +116,14 @@ export NODEMGR_HOME=${NODEMGR_HOME}/${DOMAIN_UID}/${SERVER_NAME}
113116
createFolder ${NODEMGR_HOME}
114117

115118
NODEMGR_LOG_HOME=${NODEMGR_LOG_HOME:-${LOG_HOME:-${NODEMGR_HOME}/${DOMAIN_UID}}}
119+
FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR=${FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR:-true}
116120

117121
trace "Info: NODEMGR_HOME='${NODEMGR_HOME}'"
118122
trace "Info: LOG_HOME='${LOG_HOME}'"
119123
trace "Info: SERVER_NAME='${SERVER_NAME}'"
120124
trace "Info: DOMAIN_UID='${DOMAIN_UID}'"
121125
trace "Info: NODEMGR_LOG_HOME='${NODEMGR_LOG_HOME}'"
126+
trace "Info: FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR='${FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR}'"
122127

123128
createFolder ${NODEMGR_LOG_HOME}
124129

@@ -239,7 +244,7 @@ RestartInterval=3600
239244
NumberOfFilesLimited=true
240245
FileTimeSpan=24
241246
NMHostName=${SERVICE_NAME}
242-
Arguments=${USER_MEM_ARGS} -XX\\:+UnlockExperimentalVMOptions -XX\\:+UseCGroupMemoryLimitForHeap ${serverOutOption} ${JAVA_OPTIONS}
247+
Arguments=${USER_MEM_ARGS} -XX\\:+UnlockExperimentalVMOptions -XX\\:+UseCGroupMemoryLimitForHeap -Dweblogic.SituationalConfig.failBootOnError=${FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR} ${serverOutOption} ${JAVA_OPTIONS}
243248
244249
EOF
245250

operator/src/main/resources/scripts/startServer.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ function waitUntilShutdown() {
102102
trace "Showing the server out file from ${SERVER_OUT_FILE}"
103103
${SCRIPTPATH}/tailLog.sh ${SERVER_OUT_FILE} &
104104
fi
105+
FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR=${FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR:-true}
106+
SERVER_OUT_MONITOR_INTERVAL=${SERVER_OUT_MONITOR_INTERVAL:-3}
107+
if [ ${FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR} == 'true' ] ; then
108+
${SCRIPTPATH}/monitorLog.sh ${SERVER_OUT_FILE} ${SERVER_OUT_MONITOR_INTERVAL} &
109+
fi
105110
waitForShutdownMarker
106111
}
107112

@@ -137,6 +142,8 @@ function copySitCfg() {
137142
if [ $? = 0 ]; then
138143
for local_fname in ${src_dir}/${fil_prefix}*.xml ; do
139144
copyIfChanged $local_fname $tgt_dir/`basename ${local_fname/${fil_prefix}//}`
145+
trace "Printing contents of situational configuration file $local_fname:"
146+
cat $local_fname
140147
done
141148
fi
142149

operator/src/main/resources/scripts/tailLog.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
# running this script.
1111
#
1212

13-
echo $$ > /weblogic-operator/pid
14-
tail -F -n +0 $1
13+
echo $$ > /tmp/tailLog-pid
14+
tail -F -n +0 $1

operator/src/test/java/oracle/kubernetes/operator/helpers/ConfigMapHelperTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public class ConfigMapHelperTest {
6767
"traceUtils.py",
6868
"traceUtils.sh",
6969
"wlst.sh",
70-
"tailLog.sh"
70+
"tailLog.sh",
71+
"monitorLog.sh"
7172
};
7273
private static final String DOMAIN_NS = "namespace";
7374
private static final String OPERATOR_NS = "operator";

0 commit comments

Comments
 (0)