title: Ambari 2.0 installation fails, "<urlopen error [Errno 111] Connection refused>"
body: <p>Trying to establish a Hadoop cluster via Ambari 2.0, however failure occurs at installation phase. Here are failure logs from one of the datanodes:</p>
  
  <pre><code>stderr:   /var/lib/ambari-agent/data/errors-416.txt
  
  Traceback (most recent call last):
    File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-ANY/scripts/hook.py", line 34, in &lt;module&gt;
      BeforeAnyHook().execute()
    File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 214, in execute
      method(env)
    File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-ANY/scripts/hook.py", line 29, in hook
      setup_jce()
    File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py", line 40, in setup_jce
      content = DownloadSource(format("{jce_location}/{jce_policy_zip}")),
    File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 148, in __init__
      self.env.run()
    File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 152, in run
      self.run_action(resource, action)
    File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 118, in run_action
      provider_action()
    File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 108, in action_create
      content = self._get_content()
    File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 150, in _get_content
      return content()
    File "/usr/lib/python2.6/site-packages/resource_management/core/source.py", line 50, in __call__
      return self.get_content()
    File "/usr/lib/python2.6/site-packages/resource_management/core/source.py", line 181, in get_content
      web_file = opener.open(req)
    File "/usr/lib64/python2.6/urllib2.py", line 391, in open
      response = self._open(req, data)
    File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
      '_open', req)
    File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
      result = func(*args)
    File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
      return self.do_open(httplib.HTTPConnection, req)
    File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
      raise URLError(err)
  urllib2.URLError: &lt;urlopen error [Errno 111] Connection refused&gt;
  Error: Error: Unable to run the custom hook script ['/usr/bin/python2.6', '/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-ANY/scripts/hook.py', 'ANY', '/var/lib/ambari-agent/data/command-416.json', '/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-ANY', '/var/lib/ambari-agent/data/structured-out-416.json', 'INFO', '/var/lib/ambari-agent/data/tmp']
  stdout:   /var/lib/ambari-agent/data/output-416.txt
  
  2015-05-12 14:46:24,028 - u"Directory['/var/lib/ambari-agent/data/tmp/AMBARI-artifacts/']" {'recursive': True}
  2015-05-12 14:46:24,233 - u"File['/var/lib/ambari-agent/data/tmp/AMBARI-artifacts//UnlimitedJCEPolicyJDK7.zip']" {'content': DownloadSource('http://localhost:8080/resources//UnlimitedJCEPolicyJDK7.zip')}
  2015-05-12 14:46:24,323 - Downloading the file from http://localhost:8080/resources//UnlimitedJCEPolicyJDK7.zip
  Error: Error: Unable to run the custom hook script ['/usr/bin/python2.6', '/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-ANY/scripts/hook.py', 'ANY', '/var/lib/ambari-agent/data/command-416.json', '/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-ANY', '/var/lib/ambari-agent/data/structured-out-416.json', 'INFO', '/var/lib/ambari-agent/data/tmp']
  </code></pre>
  
  <p>I think the problem is here:</p>
  
  <pre><code>2015-05-12 16:21:44,698 - Downloading the file from http://localhost:8080/resources//UnlimitedJCEPolicyJDK7.zip
  </code></pre>
  
  <p>It tries to download from localhost, but I think it should be address of the namenode. Am I missing something?</p>