Support Questions

Find answers, ask questions, and share your expertise

mysql-connector-java.jar due to HTTP error: HTTP Error 404

avatar
Contributor

I cannot start Hive Metastore Start in one of slaves because of the following error:

Traceback (most recent call last):

  File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py", line 203, in <module>
    HiveMetastore().execute()
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 375, in execute
    method(env)
  File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py", line 54, in start
    self.configure(env)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 120, in locking_configure
    original_configure(obj, *args, **kw)
  File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py", line 72, in configure
    hive(name = 'metastore')
  File "/usr/lib/python2.6/site-packages/ambari_commons/os_family_impl.py", line 89, in thunk
    return fn(*args, **kwargs)
  File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py", line 310, in hive
    jdbc_connector(params.hive_jdbc_target, params.hive_previous_jdbc_jar)
  File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py", line 527, in jdbc_connector
    content = DownloadSource(params.driver_curl_source))
  File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 166, in __init__
    self.env.run()
  File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 160, in run
    self.run_action(resource, action)
  File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 124, in run_action
    provider_action()
  File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 123, in action_create
    content = self._get_content()
  File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 160, in _get_content
    return content()
  File "/usr/lib/python2.6/site-packages/resource_management/core/source.py", line 52, in __call__
    return self.get_content()
  File "/usr/lib/python2.6/site-packages/resource_management/core/source.py", line 197, in get_content
    raise Fail("Failed to download file from {0} due to HTTP error: {1}".format(self.url, str(ex)))
resource_management.core.exceptions.Fail: Failed to download file from http://eureambarimaster1.local.eurecat.org:8080/resources//mysql-connector-java.jar due to HTTP error: HTTP Error 404: Not Found
1 ACCEPTED SOLUTION

avatar
Master Mentor

@Liana Napalkova

Have you already done the following steps?

# yum install mysql-connection-java -y

(OR) if you are downloading the mysql-connector-java JAR from some tar.gz archive then please make sure to check the following locations and create the symlinks something like following to point to your jar.

.

Then you should find some symlink as following:

Example:

# ls -l  /usr/share/java/mysql-connector-java.jar
lrwxrwxrwx 1 root root 31 Apr 19  2017 /usr/share/java/mysql-connector-java.jar -> mysql-connector-java-5.1.17.jar

https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.1.0/bk_ambari-administration/content/using_hive...

So now ambari knows how to find this jar. The JAR can be found here after

# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
# ls -l /var/lib/ambari-server/resources/mysql-connector-java.jar 
-rw-r--r-- 1 root root 819803 Sep 28 19:52 /var/lib/ambari-server/resources/mysql-connector-java.jar

View solution in original post

8 REPLIES 8

avatar
Master Mentor

@Liana Napalkova

Have you already done the following steps?

# yum install mysql-connection-java -y

(OR) if you are downloading the mysql-connector-java JAR from some tar.gz archive then please make sure to check the following locations and create the symlinks something like following to point to your jar.

.

Then you should find some symlink as following:

Example:

# ls -l  /usr/share/java/mysql-connector-java.jar
lrwxrwxrwx 1 root root 31 Apr 19  2017 /usr/share/java/mysql-connector-java.jar -> mysql-connector-java-5.1.17.jar

https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.1.0/bk_ambari-administration/content/using_hive...

So now ambari knows how to find this jar. The JAR can be found here after

# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
# ls -l /var/lib/ambari-server/resources/mysql-connector-java.jar 
-rw-r--r-- 1 root root 819803 Sep 28 19:52 /var/lib/ambari-server/resources/mysql-connector-java.jar

avatar
Master Mentor

@Liana Napalkova

You will need to make sure that the following path exist. Means on the Ambari Server there should be a symlink/jar as following which points to the path of your downloaded JAR.

# ls -l /var/lib/ambari-server/resources/mysql-connector-java.jar

avatar
Contributor

I am getting this error "No package mysql-connection-java available". Which repository of MySQL should I use?

avatar
Master Mentor

@Liana Napalkova

If it is not available in the available Yum repo then you will need to manually download it from: https://dev.mysql.com/downloads/connector/j/ After downloading the "(mysql-connector-java-5.1.46.zip)" OR tar version you will need to extract it and then you will find the "mysql-connector-java-xxxx.jar" file inside it that you need to put on your ambari server host. As following:

# ls -l /usr/share/java/mysql-connector-java.jar

Also please make sure that a synlink is created on your ambari server host as following inside /var/lib/ambari-server/resources/mysql-connector-java.jar

# ls -l /var/lib/ambari-server/resources/mysql-connector-java.jar
   ----> /usr/share/java/mysql-connector-java.jar 

Then you will need to run:

  • # ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
  • It is instructed in the following link "Using Hive with MySQL" : https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.1.0/bk_ambari-administration/content/using_hive...

    avatar
    Contributor

    When I execute "ls -l /var/lib/ambari-server/resources/mysql-connector-java.jar" in the master node, I get the correct output "/var/lib/ambari-server/resources/mysql-connector-java.jar -> /usr/share/java/mysql-connector-java.jar".

    Also the command "ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar" outputs this:
    -rw-r--r--. 1 root root 883898 Apr 13 08:54 /var/lib/ambari-server/resources/mysql-connector-java.jar

    But I still get the same error. Should I restart Ambari Server?

    avatar
    Master Mentor

    @Liana Napalkova

    Can you please check from the agent host (hive metastore host) If you have configured any "HTTP_PROXY" by any chance at the global level? On all the ambari Agent Host, in the "~/.bash_profile" or "~/.profile" profile we can add the following:

    export http_proxy=http://YOURPOROXY:PORT
    export https_proxy=https://YOURPOROXY:PORT


    Can you please verify if you are able to resolve the ambari Hostname from Agent machine and able to download the JAR using wget?

    # wget http://yyyyambarimaster1.xxxxxxxx.org:8080/resources//mysql-connector-java.jar
    # wget http://yyyyambarimaster1.xxxxxxxx.org:8080/resources/mysql-connector-java.jar

    .

    avatar
    Contributor

    Yes, I can download JAR files. I restarted the Ambari Server and now the problem is resolved.

    avatar
    New Contributor

    I've followed all the steps, but I'm not getting these last steps. And, it's showing the same error. Please help me through it.