WebLogic啟用管理埠後使用stopWebLogic無法正常停止服務的問題
WebLogic啟動管理端口後使用stopWebLogic無法正常停止的問題
這是我自己在做的一個小實驗發現的小問題,啟用管理埠後執行stopWebLogic.sh停止服務報錯,無法正常停止
啟動時一切正常,通過https://192.168.44.132:9002訪問console也沒有問題,可在使用stopWebLogic.sh停止服務的時候卻報錯了:
異常資訊:
[[email protected] bin]$ ./stopWebLogic.sh weblogic
Stopping Weblogic Server...
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to t3s://localhost:9002 with userid weblogic ...
<2011-5-25 上午09時45分21秒 CST> <Warning> <Security> <BEA-090542> <Certificate chain received from localhost - 127.0.0.1 was not trusted causing SSL handshake failure. Check the certificate chain to determine if it should be trusted or not. If it should be trusted, then update the client trusted CA configuration to trust the CA certificate that signed the peer certificate chain. If you are connecting to a WLS server that is using demo certificates (the default WLS server behavior), and you want this client to trust demo certificates, then specify
This Exception occured at Wed May 25 09:45:21 CST 2011.
javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3s://localhost:9002: Destination unreachable; nested exception is:
javax.net.ssl.SSLKeyException: [Security:090542]Certificate chain received from localhost - 127.0.0.1 was not trusted causing SSL handshake failure. Check the certificate chain to determine if it should be trusted or not. If it should be trusted, then update the client trusted CA configuration to trust the CA certificate that signed the peer certificate chain. If you are connecting to a WLS server that is using demo certificates (the default WLS server behavior), and you want this client to trust demo certificates, then specify
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:49)
at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:773)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:363)
at weblogic.jndi.Environment.getContext(Environment.java:307)
at weblogic.jndi.Environment.getContext(Environment.java:277)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at weblogic.management.scripting.WLSTHelper.populateInitialContext(WLSTHelper.java:494)
at weblogic.management.scripting.WLSTHelper.initDeprecatedConnection(WLSTHelper.java:547)
at weblogic.management.scripting.WLSTHelper.initConnections(WLSTHelper.java:299)
at weblogic.management.scripting.WLSTHelper.connect(WLSTHelper.java:201)
at weblogic.management.scripting.WLScriptContext.connect(WLScriptContext.java:60)
at weblogic.management.scripting.utils.WLSTUtil.initializeOnlineWLST(WLSTUtil.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:160)
at org.python.core.PyMethod.__call__(PyMethod.java:96)
at org.python.core.PyObject.__call__(PyObject.java:248)
at org.python.core.PyObject.invoke(PyObject.java:2016)
at org.python.pycode._pyx6.connect$1(<iostream>:16)
at org.python.pycode._pyx6.call_function(<iostream>)
at org.python.core.PyTableCode.call(PyTableCode.java:208)
at org.python.core.PyTableCode.call(PyTableCode.java:404)
at org.python.core.PyFunction.__call__(PyFunction.java:184)
at org.python.pycode._pyx18.f$0(/home/weblogic/bea/user_projects/domains/base_domain/shutdown.py:1)
at org.python.pycode._pyx18.call_function(/home/weblogic/bea/user_projects/domains/base_domain/shutdown.py)
at org.python.core.PyTableCode.call(PyTableCode.java:208)
at org.python.core.PyCode.call(PyCode.java:14)
at org.python.core.Py.runCode(Py.java:1135)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:167)
at weblogic.management.scripting.WLST.main(WLST.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at weblogic.WLST.main(WLST.java:29)
Caused by: java.net.ConnectException: t3s://localhost:9002: Destination unreachable; nested exception is:
javax.net.ssl.SSLKeyException: [Security:090542]Certificate chain received from localhost - 127.0.0.1 was not trusted causing SSL handshake failure. Check the certificate chain to determine if it should be trusted or not. If it should be trusted, then update the client trusted CA configuration to trust the CA certificate that signed the peer certificate chain. If you are connecting to a WLS server that is using demo certificates (the default WLS server behavior), and you want this client to trust demo certificates, then specify -Dweblogic.security.TrustKeyStore=DemoTrust on the command line for this client.; No available router to destination
at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:204)
at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:154)
at weblogic.jndi.WLInitialContextFactoryDelegate$1.run(WLInitialContextFactoryDelegate.java:342)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:337)
... 38 more
Caused by: java.rmi.ConnectException: Destination unreachable; nested exception is:
javax.net.ssl.SSLKeyException: [Security:090542]Certificate chain received from localhost - 127.0.0.1 was not trusted causing SSL handshake failure. Check the certificate chain to determine if it should be trusted or not. If it should be trusted, then update the client trusted CA configuration to trust the CA certificate that signed the peer certificate chain. If you are connecting to a WLS server that is using demo certificates (the default WLS server behavior), and you want this client to trust demo certificates, then specify -Dweblogic.security.TrustKeyStore=DemoTrust on the command line for this client.; No available router to destination
at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:475)
at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:326)
at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:261)
at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:204)
at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:226)
at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:189)
... 43 more
Problem invoking WLST - Traceback (innermost last):
File "/home/weblogic/bea/user_projects/domains/base_domain/shutdown.py", line 1, in ?
File "<iostream>", line 22, in connect
WLSTException: 'Error occured while performing connect : Error getting the initial context. There is no server running at t3s://localhost:9002 Use dumpStack() to view the full stacktrace'
Done
問題分析:
造成這個錯誤的主要原因在於WebLogic啟用了管理埠,通過之前預設的URL已經無法訪問console,而在stopWebLogic.sh中並不知道這些,它依然企圖去停止預設的那個ADMIN_URL上的服務,當然找不到,自然就報錯了。所以應該在stopWebLogic.sh中做出相應的變動,把ADMIN_URL修改為相應的t3s://192.168.44.132:9002才可以,另外因為使用到了數字證書,所以還需要在setDomainEnv.sh中JAVA_OPTIONS環境變數中新增:-Dweblogic.security.TrustKeyStore=Demotrust
修改後的stopWebLogic.sh指令碼內容如下:
# set ADMIN_URL
if [ "$1" != "" ] ; then
ADMIN_URL="$1"
shift
else
if [ "${ADMIN_URL}" = "" ] ; then
ADMIN_URL="t3s://localhost:9002"
fi
fi
其中IP根據跟人計算機不同做相應更改即可。
修改後的setDomainEnv.sh的JAVA_OPTIONS環境變數如下所示:
JAVA_OPTIONS="${JAVA_OPTIONS} ${JAVA_PROPERTIES}
-Dweblogic.security.TrustKeyStore=DemoTrust -Dwlw.iterativeDev=${iterativeDevFlag} -Dwlw.testConsole=${testConsoleFlag} -Dwlw.logErrorsToConsole=${logErrorsToConsoleFlag} "
export JAVA_OPTIONS
以上兩項都修改完畢後,再次執行stopWebLogic.sh,WebLogic終於正常停止了:
[[email protected] bin]$ ./stopWebLogic.sh
Stopping Weblogic Server...
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to t3s://localhost:9002 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'base_domain'.
Shutting down the server AdminServer with force=false while connected to AdminServer ...
Disconnected from weblogic server: AdminServer
Exiting WebLogic Scripting Tool.
Done