Saturday, January 4, 2014

WebLogic Startup Mode: Development or Production


Differences

Startup Mode
Development                    Production
Auto deployment
(to admin server only)
YesNo
Automatically created
boot.properties for Admin server only under
$DOMAIN_HOME/servers/$SERVER_NAME/security 
YesNo
Nodemanger username and password
default admin
credentials
randomly
generated
SSL demo certificates cause warning in log files
NoYes
Log file are rotated at server startup
YesNo
On demand deployment of internal applications as default
YesNo
Availability of web service test client
YesNo
Availability of Classloader Analysis Tool
YesNo
Availability of Fast Swap
YesNo
Change Center Enabled
NoYes
Default start parameters
when using Sun JDK and the default
startWebLogic script 
java
-client
-Xms256m
-Xmx512m
-XX:CompileThreshold=
8000
-XX:PermSize=128m
-XX:MaxPermSize=256m
java
-server
-Xms256m
-Xmx512m
-XX:MaxPermSiz=256m
The following settings in the weblogic.xml deployment descriptors default to -1:
NoYes
Differences in previous WebLogic versions:
Up to WebLogic 11:
Default JDK used for new domain
SunJRockit
Up to WebLogic 8 only:
Default number of execute threads
1525
Up to WebLogic 8 only:
maximum number of JDBC connections default setting
1525




Configuration

There is different ways to configure the WebLogic startup mode:
  1. The startup mode can be configured with the admin console, as shown on the screenshot below (requires a restart). Once it’s set to production mode it cannot be reverted with the admin console.
  2. Supply the -Dweblogic.ProductionModeEnabled=true switch as startup parameter
  3. Set the PRODUCTION_MODE variable in the setDomainEnv script in the directory DOMAIN_NAME/bin.

What you should know

Some issues to be aware of:
  • The differences between the two settings depend on the WebLogic version. This can be a bit confusing when you are running different environments with different versions. See the table above: For WebLogic 8 the maximum number of connections in a JDBC connection pool defaults to 25 in production mode (but 15 in development mode); for WebLogic 12c it defaults to 15 in both cases.
  • You cannot revert to development mode from the WebLogic admin console. It’s like the child-proof lock in the back of your car. I understand that is makes sense to protect the children in the back seat your car from themselves but you are are logged with the admin role – still you cannot revert to development mode using the admin console.
  • Autodeployment is not used that much anymore since it only deploys to the admin server – so it doesn’t make sense for a production domain. What if you are a developer? Then your IDE is deploying to the admin server, that is correct – but your IDE is typically not using autodeployment.
  • Note, that there will be a randomly set user and password for nodemanager when creating your domain in production mode with config.sh (see comments from Jacco).
  • You cannot disable the change center in production mode

HOW TO RECOVER WEBLOGIC ADMIN PASSWORD


There is another smart way to get past this problem of "lost weblogic admin password" , what it does is

"INSTEAD OF TRYING TO RECOVER THE ORIGINAL PASSWORD,
https://recover-weblogic-password.appspot.com/
   1) ADD ANOTHER ADMIN USER
   2) LOGIN TO CONSOLE
   3) CHANGE THE PASSWORD OF ORIGINAL USER


These three steps are much faster to execute and a smarter approach i would say. Also it involves less user mistakes.

Here is the step by step guide

Note : replace the $DOMAIN_HOME with the actual path in your environment,.


1) shutdown the domain ( All managed servers & then admin)


2) backup your $DOMAIN_HOME/security folder in case u need it


cd $DOMAIN_HOME 
tar cvf security.tar security

3) set the environment

$cd $DOMAIN_HOME/bin
$ . ./setDomainEnv.sh 

Note : dont forget the first dot(.) 

4) change to security folder & Add the new admin user using the below command after setting the environment

$ cd ../security    ( important step, otherwise you will get IO exception) 

$java weblogic.security.utils.AdminAccount adminuser1 welcome1 .

Note : there is a dot (.) at the end of the command
this will add the user adminuser1 as the administrator.

5)  remove the below file from ldap directory


rm $DOMAIN_HOME/servers//data/ldap/DefaultAuthenticatormyrealmInit.initialized
6)  start the server using startWebLogic.sh

Note : do not use the boot.properties file .. or a wrapper script at the first time


7) login to the console and change the password of the original admin user

******************************************************************

How to decrypt WebLogic passwords with WLST

Sooner or later you will find the situation where you do not remember any of the WebLogic Server password’s stored in the configuration files.

Some examples are:
a) The WebLogic Server administrator credentials (username and password) stored in the files config.xml and boot.properties
b) Node Manager password, stored also in the config.xml file (if you still have the default password, don’t wait and change it know!!)
c) Database password used by the JDBC Data Sources and stored in the file [DOMAIN_HOME]/config/jdbc/[datasource_name].xml

So, how to decrypt this data in 3 easy steps. Just follow this techtapa recipe:

Ingredients:
- 1 WLST script
- The path of the WebLogic Server domain
- The encrypted field, for example, username and password from boot.properties

Preparation:
1. Copy this WLST script (you can also download it here).


import os
import weblogic.security.internal.SerializedSystemIni
import weblogic.security.internal.encryption.ClearOrEncryptedService

def decrypt(domainHomeName, encryptedPwd):
    domainHomeAbsolutePath = os.path.abspath(domainHomeName)
    encryptionService = weblogic.security.internal.SerializedSystemIni.getEncryptionService(domainHomeAbsolutePath)
    ces = weblogic.security.internal.encryption.ClearOrEncryptedService(encryptionService)
    clear = ces.decrypt(encryptedPwd)
    print "RESULT:" + clear

try:
    if len(sys.argv) == 3:
        decrypt(sys.argv[1], sys.argv[2])
    else:
  print "INVALID ARGUMENTS"
  print " Usage: java weblogic.WLST decryptPassword.py DOMAIN_HOME ENCRYPTED_PASSWORD"
  print " Example:"
  print " java weblogic.WLST decryptPassword.py D:/Oracle/Middleware/user_projects/domains/base_domain {AES}819R5h3JUS9fAcPmF58p9Wb3syTJxFl0t8NInD/ykkE="
except:
    print "Unexpected error: ", sys.exc_info()[0]
    dumpStack()
    raise

2. Set your environment (CLASSPATH, PATH,..). Open a console, go to [FMW_HOME]/wlserver_10.3/server/bin/ and run the script setWLSEnv.sh:
$ . ./setWLSEnv.sh

3.Run the script. Go to the path where you copied the WLST script ( decryptPassword.py) and run it. You must provide two arguments, the WebLogic Server domain Home full path and the string you want to decrypt, for example:

$ java weblogic.WLST decryptPassword.py /opt/oracle/Middleware/user_projects/domains/base_domain {AES}LU5dLPP0PliNb5Ml1Fo7rD2AbNFwLcyLtYUEDTb+8zY\=

$ java weblogic.WLST decryptPassword.py /XXXXX/applmgr/fs2/FMW_Home/user_projects/domains/EBS_domain_xx122i {AES}Cb3qjo8vUPVBkkxMH3FSiIm4HJXC+RdQ5CjzRoHGPdE=

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

RESULT:weblogic123

Enjoy it!!