1. 程式人生 > 實用技巧 >weblogic修改密碼&密碼重置

weblogic修改密碼&密碼重置

一、Console修改密碼後,掛載的服務無法重啟【解決辦法】

1、開啟 weblogic 控制檯,安全領域 --> myrealm --> 使用者和組,將會看到 weblogic 使用者,可以直接刪除,也可以點選 weblogic 進行修改,這裡儲存後立即生效。

2、這時重啟 weblogic 控制檯會報錯,通過 cmd 可以看到如下提示資訊。

<2015-6-27 下午01時02分27秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED>  
<2015-6-27 下午01時02分27秒 CST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down>  
<2015-6-27 下午01時02分27秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>  
#這是因為啟動服務用的使用者名稱密碼和登入的是同一個,而啟動時所讀取的boot.properties檔案中的密碼還是舊的。

3、所以需要去修改 DOMAIN_HOME/servers/server_name/security/boot.properties 檔案,把 username 和 password 改為明文的新密碼,各 server 都得改。

4、然後重啟受管伺服器和管理伺服器即可,啟動成功後 boot.properties 檔案內容已改成了密文。

二. weblogic console登入密碼遺忘【解決方法】

1、首先進入 weblogic 安裝目錄,備份三個檔案:boot.properties,DefaultAuthenticatorInit.ldift,DefaultAuthenticatormyrealmInit.initialized。

2、重新生成一個新的 DefaultAuthenticatorInit.ldift 檔案。具體操作為:

#找到 weblogic.jar 路徑

#在 %DOMAIN_HOME%/security 下執行如下命令:
java -classpath /data/bea/weblogic11/wlserver_10.3/server/lib/weblogic.jar weblogic.security.utils.AdminAccount weblogic weblogic123 .

#其中jar可以是相對路徑,也可以是絕對路徑;weblogic.security.utils.AdminAccount固定格式;weblogic 是使用者名稱,weblogic123 是密碼,最後加一個空格 和一個點.  最後一個.不要忘了)

#執行完會在當前路徑下面生成一個新的 DefaultAuthenticatorInit.ldift 檔案。

3、到 XX/servers/AdminServer/security 路徑下新建一個 boot.properties 檔案,並寫入:username=weblogic password=weblogic123儲存。

4、刪除 XX/servers/AdminServer/data/ 下面的ldap資料夾,

5、重新啟動 weblogic,啟動成功,即可刪除備份的 boot.properties,DefaultAuthenticatorInit.ldift,DefaultAuthenticatormyrealmInit.initialized 三個檔案。

三. 問題補充說明

帳號/密碼修改後啟動 weblogic 失敗,我遇上兩種情況. 錯誤差異都是從:<Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>語句之後開始體現的.

3.1. 當通過./startManagedWebLogic.sh 啟動時,手動輸入錯誤的密碼,列印日誌如下:

假設現在帳號/密碼已從 weblogic/weblogic123 改成 weblogic/weblogic798 ,此時故意輸錯密碼成 wbwbwb

[weblogic@localhost bin]$ ./startManagedWebLogic.sh httpserver http://localhost:7001
.
.
JAVA Memory arguments: -Xms256m -Xmx512m  -XX:MaxPermSize=128m
.
WLS Start Mode=Production
.
CLASSPATH=/home/weblogic/Oracle/Middleware/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/weblogic/Oracle/Middleware/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/weblogic/Oracle/Middleware/jdk160_29/lib/tools.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:/home/weblogic/Oracle/Middleware/modules/features/weblogic.server.modules_10.3.6.0.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/webservices.jar:/home/weblogic/Oracle/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/weblogic/Oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/common/derby/lib/derbyclient.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/xqrl.jar:.:/home/rootbobo/data/jdk/jdk1.7.0_80/lib/dt.jar:/home/rootbobo/data/jdk/jdk1.7.0_80/lib/tools.jar
.
PATH=/home/weblogic/Oracle/Middleware/wlserver_10.3/server/bin:/home/weblogic/Oracle/Middleware/modules/org.apache.ant_1.7.1/bin:/home/weblogic/Oracle/Middleware/jdk160_29/jre/bin:/home/weblogic/Oracle/Middleware/jdk160_29/bin:/home/rootbobo/data/jdk/jdk1.7.0_80/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/weblogic/bin
.
***************************************************
*  To start WebLogic Server, use a username and   *
*  password assigned to an admin-level user.  For *
*  server administration, use the WebLogic Server *
*  console at http://hostname:port/console        *
***************************************************
starting weblogic with Java version:
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Server VM (build 20.4-b02, mixed mode)
Starting WLS with line:
/home/weblogic/Oracle/Middleware/jdk160_29/bin/java -server   -Xms256m -Xmx512m  -XX:MaxPermSize=128m -Dweblogic.Name=httpserver -Djava.security.policy=/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.policy  -Dweblogic.ProductionModeEnabled=true -Dweblogic.security.SSL.trustedCAKeyStore=/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/cacerts   -da -Dplatform.home=/home/weblogic/Oracle/Middleware/wlserver_10.3 -Dwls.home=/home/weblogic/Oracle/Middleware/wlserver_10.3/server -Dweblogic.home=/home/weblogic/Oracle/Middleware/wlserver_10.3/server   -Dweblogic.management.discover=false -Dweblogic.management.server=http://localhost:7001  -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole=false -Dweblogic.ext.dirs=/home/weblogic/Oracle/Middleware/patch_wls1036/profiles/default/sysext_manifest_classpath:/home/weblogic/Oracle/Middleware/patch_ocp371/profiles/default/sysext_manifest_classpath  weblogic.Server
<2017-5-18 下午04時35分50秒 CST> <Info> <Security> <BEA-090905> <Disabling CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true> 
<2017-5-18 下午04時35分50秒 CST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true> 
<2017-5-18 下午04時35分51秒 CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Server VM Version 20.4-b02 from Sun Microsystems Inc.> 
<2017-5-18 下午04時35分52秒 CST> <Info> <Security> <BEA-090065> <Getting boot identity from user.> 
Enter username to boot WebLogic server:weblogic
Enter password to boot WebLogic server:
<2017-5-18 下午04時35分59秒 CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3.6.0  Tue Nov 15 08:52:36 PST 2011 1441050 > 
<2017-5-18 下午04時36分01秒 CST> <Emergency> <Management> <BEA-141151> <The admin server could not be reached at http://localhost:7001.> 
<2017-5-18 下午04時36分01秒 CST> <Info> <Configuration Management> <BEA-150018> <This server is being started in managed server independence mode in the absence of the admin server.> 
<2017-5-18 下午04時36分01秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING> 
<2017-5-18 下午04時36分01秒 CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool> 
<2017-5-18 下午04時36分01秒 CST> <Notice> <Log Management> <BEA-170019> <The server log file /home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/servers/httpserver/logs/httpserver.log is opened. All server side log events will be written to this file.> 
<2017-5-18 下午04時36分04秒 CST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.> 
<2017-5-18 下午04時36分04秒 CST> <Critical> <Security> <BEA-090403> <Authentication for user weblogic denied> 
<2017-5-18 下午04時36分04秒 CST> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: weblogic.security.SecurityInitializationException: Authentication for user weblogic denied
weblogic.security.SecurityInitializationException: Authentication for user weblogic denied
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doBootAuthorization(CommonSecurityServiceManagerDelegateImpl.java:966)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1054)
        at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:873)
        at weblogic.security.SecurityService.start(SecurityService.java:141)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        Truncated. see log file for complete stacktrace
Caused By: javax.security.auth.login.FailedLoginException: [Security:090304]Authentication Failed: User weblogic javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User weblogic denied
        at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:261)
        at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.bea.common.security.internal.service.LoginModuleWrapper.login(LoginModuleWrapper.java:106)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        Truncated. see log file for complete stacktrace
> 
<2017-5-18 下午04時36分04秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED> 
<2017-5-18 下午04時36分04秒 CST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down> 
<2017-5-18 下午04時36分04秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN> 
[weblogic@localhost bin]$

如果是這個問題,用正確的使用者名稱,密碼再次啟動就可以了

3.2. 誤以為 boot.properties 配置錯誤,其實是 NodeManager.sh 密碼問題

該錯誤一般在使用 NodeManager.sh 啟動被管理 Server 時會報.

[weblogic@localhost bin]$ ./startWebLogic.sh 
.
.
JAVA Memory arguments: -Xms256m -Xmx512m  -XX:MaxPermSize=128m
.
WLS Start Mode=Production
.
CLASSPATH=/home/weblogic/Oracle/Middleware/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/weblogic/Oracle/Middleware/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/weblogic/Oracle/Middleware/jdk160_29/lib/tools.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:/home/weblogic/Oracle/Middleware/modules/features/weblogic.server.modules_10.3.6.0.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/webservices.jar:/home/weblogic/Oracle/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/weblogic/Oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/common/derby/lib/derbyclient.jar:/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/xqrl.jar:.:/home/rootbobo/data/jdk/jdk1.7.0_80/lib/dt.jar:/home/rootbobo/data/jdk/jdk1.7.0_80/lib/tools.jar
.
PATH=/home/weblogic/Oracle/Middleware/wlserver_10.3/server/bin:/home/weblogic/Oracle/Middleware/modules/org.apache.ant_1.7.1/bin:/home/weblogic/Oracle/Middleware/jdk160_29/jre/bin:/home/weblogic/Oracle/Middleware/jdk160_29/bin:/home/rootbobo/data/jdk/jdk1.7.0_80/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/weblogic/bin
.
***************************************************
*  To start WebLogic Server, use a username and   *
*  password assigned to an admin-level user.  For *
*  server administration, use the WebLogic Server *
*  console at http://hostname:port/console        *
***************************************************
starting weblogic with Java version:
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Server VM (build 20.4-b02, mixed mode)
Starting WLS with line:
/home/weblogic/Oracle/Middleware/jdk160_29/bin/java -server   -Xms256m -Xmx512m  -XX:MaxPermSize=128m -Dweblogic.Name=AdminServer -Djava.security.policy=/home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.policy  -Dweblogic.ProductionModeEnabled=true   -da -Dplatform.home=/home/weblogic/Oracle/Middleware/wlserver_10.3 -Dwls.home=/home/weblogic/Oracle/Middleware/wlserver_10.3/server -Dweblogic.home=/home/weblogic/Oracle/Middleware/wlserver_10.3/server   -Dweblogic.management.discover=true  -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole=false -Dweblogic.ext.dirs=/home/weblogic/Oracle/Middleware/patch_wls1036/profiles/default/sysext_manifest_classpath:/home/weblogic/Oracle/Middleware/patch_ocp371/profiles/default/sysext_manifest_classpath  weblogic.Server
<2017-5-18 下午05時03分53秒 CST> <Info> <Security> <BEA-090905> <Disabling CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true> 
<2017-5-18 下午05時03分53秒 CST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true> 
<2017-5-18 下午05時03分54秒 CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Server VM Version 20.4-b02 from Sun Microsystems Inc.> 
<2017-5-18 下午05時03分55秒 CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3.6.0  Tue Nov 15 08:52:36 PST 2011 1441050 > 
<2017-5-18 下午05時03分56秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING> 
<2017-5-18 下午05時03分56秒 CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool> 
<2017-5-18 下午05時03分56秒 CST> <Notice> <Log Management> <BEA-170019> <The server log file /home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/logs/AdminServer.log is opened. All server side log events will be written to this file.> 
<2017-5-18 下午05時04分00秒 CST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.> 
<2017-5-18 下午05時04分00秒 CST> <Critical> <Security> <BEA-090402> <Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted.> 
<2017-5-18 下午05時04分00秒 CST> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: weblogic.security.SecurityInitializationException: Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted.
weblogic.security.SecurityInitializationException: Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted.
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doBootAuthorization(CommonSecurityServiceManagerDelegateImpl.java:960)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1054)
        at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:873)
        at weblogic.security.SecurityService.start(SecurityService.java:141)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        Truncated. see log file for complete stacktrace
Caused By: javax.security.auth.login.FailedLoginException: [Security:090304]Authentication Failed: User weblogic javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User weblogic denied
        at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:261)
        at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.bea.common.security.internal.service.LoginModuleWrapper.login(LoginModuleWrapper.java:106)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        Truncated. see log file for complete stacktrace
> 
<2017-5-18 下午05時04分00秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED> 
<2017-5-18 下午05時04分00秒 CST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down> 
<2017-5-18 下午05時04分00秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>

原因分析:
其實這個時候我們已修改了 AdminServer 管理控制檯密碼,但是 NodeManager 記住的還是舊密碼。而用 NodeManager 啟動被管理 Server 時,是不需要讀取 boot.properties 的,只有在用 ./startManagerWeblogic.sh 時才需要用到 boot.properties 帳號密碼.

解決思路:
1、需要進入wlst(weblogic script tool), 讓 NodeManager 重新抓取 AdminServer 的配置

#以下命令,請一句一句執行.
cd /data/weblogic/wls/wlserver_10.3/common/bin

sh ./wlst.sh 

connect('weblogic','password123','t3://ip:7004')

nmEnroll('/data/weblogic/servers/m95/')

disconnect()

exit()

2、執行完畢,重啟NodeManager

3、控制檯啟動被管理Server下.

注意:這裡如果還是報一樣錯誤.....沒關係,進入到被管理server目錄下,清下快取

cd /oracle/esbapp/bea/weblogic11/user_projects/domains/esb_domain/servers/vhlSearch/
rm -rf tmp
rm -rf stage/
rm -rf cache/
rm -rf data

參考

https://blog.csdn.net/nayan8664/article/details/81330086
nmEnroll解釋: 參考 https://my.oschina.net/psuyun/blog/145595#OSC_h2_1 搜尋 nmEnroll .