Huaiyao's Notes

emcli error

Got an error when doing emcli login.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
POCCSLC:/opt/oracle/oem13c/bin>./emcli
Oracle Enterprise Manager 13c Release 2 EM CLI with Scripting option.
Copyright (c) 1996, 2016 Oracle Corporation and/or its affiliates. All rights reserved.
Type help() for help and exit() to get out.
emcli>login()
Jul 06, 2017 7:59:38 AM oracle.sysman.emCLI.verb.LoginVerb execute
SEVERE:
oracle.sysman.emCLI.omsbrowser.HttpConnectionException:
at oracle.sysman.emCLI.omsbrowser.LoginSystem.establishSession(LoginSystem.java:340)
at oracle.sysman.emCLI.omsbrowser.OMSBrowser.getPageInternal(OMSBrowser.java:930)
at oracle.sysman.emCLI.omsbrowser.OMSBrowser.getPageCommon(OMSBrowser.java:854)
at oracle.sysman.emCLI.omsbrowser.OMSBrowser.getPage(OMSBrowser.java:799)
at oracle.sysman.emCLI.verb.LoginVerb.doLogin(LoginVerb.java:598)
at oracle.sysman.emCLI.verb.LoginVerb.execute(LoginVerb.java:350)
at oracle.sysman.emSDK.emCLI.CLIController.execute(CLIController.java:367)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at oracle.sysman.emCLI.StandAloneLaunchHandler.invoke(StandAloneLaunchHandler.java:413)
at oracle.sysman.emCLI.StandAloneLaunchHandler.launch(StandAloneLaunchHandler.java:286)
at oracle.sysman.emSDK.emCLI.CLIController.go(CLIController.java:295)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
at org.python.core.PyObject.__call__(PyObject.java:441)
at org.python.core.PyObject.__call__(PyObject.java:447)
at org.python.core.PyMethod.__call__(PyMethod.java:154)
at emcli.util$py.do_verb_processing$1(/opt/oracle/oem13c/bin/./emsh.jar/jython_lib/emcli/util.py:91)
at emcli.util$py.call_function(/opt/oracle/oem13c/bin/./emsh.jar/jython_lib/emcli/util.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
at org.python.core.PyFunction.function___call__(PyFunction.java:376)
at org.python.core.PyFunction.__call__(PyFunction.java:371)
at org.python.core.PyFunction.__call__(PyFunction.java:366)
at org.python.core.PyObject._callextra(PyObject.java:527)
at org.python.pycode._pyx24.login$1(<string>:3)
at org.python.pycode._pyx24.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
at org.python.core.PyBaseCode.call(PyBaseCode.java:114)
at org.python.core.PyFunction.__call__(PyFunction.java:307)
at org.python.pycode._pyx29.f$0(<stdin>:1)
at org.python.pycode._pyx29.call_function(<stdin>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at org.python.core.Py.exec(Py.java:1319)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:215)
at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:89)
at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:70)
at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:46)
at org.python.util.InteractiveConsole.push(InteractiveConsole.java:110)
at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:90)
at oracle.sysman.emSDK.emCLI.CLIController$InteractiveModeHandler.launch(CLIController.java:578)
at oracle.sysman.emSDK.emCLI.CLIController.launch(CLIController.java:255)
at oracle.sysman.emSDK.emCLI.CLIController.main(CLIController.java:207)
Caused by: java.net.UnknownHostException: rjin000dbs001.rjinprod.com: No address associated with hostname
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:922)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1316)
at java.net.InetAddress.getAllByName0(InetAddress.java:1269)
at java.net.InetAddress.getAllByName(InetAddress.java:1185)
at java.net.InetAddress.getAllByName(InetAddress.java:1119)
at HTTPClient.HTTPConnection$11.run(HTTPConnection.java:3750)
at java.security.AccessController.doPrivileged(Native Method)
at HTTPClient.HTTPConnection.getSocket(HTTPConnection.java:3747)
at HTTPClient.HTTPConnection.doConnect(HTTPConnection.java:4579)
at HTTPClient.HTTPConnection.sendRequest(HTTPConnection.java:3516)
at HTTPClient.HTTPConnection.handleRequest(HTTPConnection.java:3436)
at HTTPClient.HTTPConnection$10.run(HTTPConnection.java:3187)
at HTTPClient.HTTPConnection$10.run(HTTPConnection.java:3178)
at HTTPClient.HttpClientConfiguration.doAction(HttpClientConfiguration.java:1083)
at HTTPClient.HTTPConnection.doAction(HTTPConnection.java:5616)
at HTTPClient.HTTPConnection.setupRequest(HTTPConnection.java:3178)
at HTTPClient.HTTPConnection.Get(HTTPConnection.java:947)
at oracle.sysman.emCLI.omsbrowser.LoginSystem.establishSession(LoginSystem.java:150)
... 51 more
Error: Connection to the current OMS could not be established. Check the log files for further details.

Strange error.

1
Caused by: java.net.UnknownHostException: rjin000dbs001.rjinprod.com: No address associated with hostname

Try to troubleshoot.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
POCCSLC:/opt/oracle/oem13c/bin>./emcli status
Oracle Enterprise Manager 13c Release 2 EM CLI.
Copyright (c) 1996, 2016 Oracle Corporation and/or its affiliates. All rights reserved.
Instance Home : /home/oracle/.emcli
Verb Jars Home : null
Status : Configured
EM CLI Home : /opt/oracle/oem13c/bin/.
EM CLI Version : 13.2.0.0.0
Java Home : /opt/oracle/oem13c/oracle_common/jdk/jre
Java Version : 1.7.0_111
Log file : /home/oracle/.emcli/.emcli.log
Log level : SEVERE
EM URL : https://rjin000dbu001.rjincorp.com:7803/em
EM user : sysman
Auto login : false
Trust all certificates : true

1
2
3
4
5
6
7
8
9
10
POCCSLC:/opt/oracle/oem13c/bin>./emcli setup
Oracle Enterprise Manager 13c Release 2.
Copyright (c) 1996, 2016 Oracle Corporation and/or its affiliates. All rights reserved.
Instance Home : /home/oracle/.emcli
Verb Jars Home : null
EM URL : https://rjin000dbu001.rjincorp.com:7803/em
EM user : sysman
Trust all certificates : true
Auto login : false

All good.

突然灵光一次,会不会是某些环境变量导致的。

1
2
3
4
POCCSLC:/opt/oracle/oem13c/bin>env |grep -i emcli
EMCLI_OMS_URL=https://rjin000dbs001.rjinprod.com:7800/em
EMCLI_TRUSTALL=true
EMCLI_USERNAME=sysman

果然。
Fix by:

1
export EMCLI_OMS_URL=https://rjin000dbu001.rjincorp.com:7803/em