Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

hive rest api: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)

Highlighted

hive rest api: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)

New Contributor
When i try to execute below hive rest api to access hive tables, in "stderr" am seeing below error.
 curl -s -d execute="select+*+from+employee01;" -d statusdir="/user/root/"  'http://localhost:50111/templeton/v1/hive?user.name=root'
{"id":"job_1491487510034_0007"}
===========================
 # hadoop fs -cat stderr
WARNING: Use "yarn jar" to launch YARN applications.
Logging initialized using configuration in jar:file:/data3/hadoop/yarn/local/usercache/root/filecache/37/hive-common.jar!/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:494)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:680)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:624)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
        at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1533)
        at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:86)
        at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:132)
        at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:104)
        at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:3000)
        at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3019)
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:475)
        ... 8 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1531)
        ... 14 more
Caused by: MetaException(message:Got exception: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)
        at org.apache.hadoop.hive.metastore.MetaStoreUtils.logAndThrowMetaException(MetaStoreUtils.java:1223)
        at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:229)
        at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:74)
        ... 19 more
===================================
# hadoop fs -cat stdout  ------> (No output)
# Templeton status is ok.
curl http://localhost:50111/templeton/v1/status
{"version":"v1","status":"ok"}
7 REPLIES 7

Re: hive rest api: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)

Master Collaborator

Seems like a problem in the webhcat server configuration. Can you check your webhcat server log, it should print various parameters and values it used during the startup. You might want to check the value of hive.metastore.uris there. How was this cluster installed?

Re: hive rest api: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)

New Contributor

@Deepesh

## As per below webhcat status is ok.

curl http://localhost:50111/templeton/v1/status

{"version":"v1","status":"ok"}

## And below is the command curl command ran to access table and below is the webhcat log and i don't see any issues in the logs. Can you kindly suggest further.

Command: curl -s -d execute="select+*+from+employee01;" -d statusdir="/user/root" 'http://localhost:50111/templeton/v1/hive?user.name=root'

webhcat.log:

INFO| 10 Apr 2017 22:27:06,321 | org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl | Timeline service address: http://localhost:50111/templeton/v1/status INFO | 10 Apr 2017 22:27:06,513 | org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl | Timeline service address: http://localhost:50111/templeton/v1/status INFO | 10 Apr 2017 22:27:06,613 | org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl | Timeline service address: http://localhost:50111/templeton/v1/status INFO | 10 Apr 2017 22:27:06,621 | org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider | Failing over to rm2 INFO | 10 Apr 2017 22:27:26,063 | org.apache.hadoop.mapreduce.JobSubmitter | number of splits:1 INFO | 10 Apr 2017 22:27:26,164 | org.apache.hadoop.mapreduce.JobSubmitter | Submitting tokens for job: job_1491487510034_0009 INFO | 10 Apr 2017 22:27:26,216 | org.apache.hadoop.yarn.client.api.impl.YarnClientImpl | Submitted application application_1491487510034_0009 INFO | 10 Apr 2017 22:27:26,218 | org.apache.hadoop.mapreduce.Job | The url to track the job: http://localhost:50111/templeton/v1/status INFO | 10 Apr 2017 22:27:26,219 | org.apache.curator.framework.imps.CuratorFrameworkImpl | Starting INFO | 10 Apr 2017 22:27:26,224 | org.apache.curator.framework.state.ConnectionStateManager | State change: CONNECTED

Re: hive rest api: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)

Master Collaborator

Status check just verifies that the Templeton (aka webhcat) server is up, it doesn't mean that all different REST APIs will work. Can you post the output of the following command?

grep "hive.metastore.uris" PATH_TO_WEBHCAT_LOG

Re: hive rest api: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)

New Contributor

@Deepesh

I don't see any output for the grep command. And can you kindly let me know, how to verify webhcat is working fine or not.

================

# grep "hive.metastore.uris" webhcat.log ; echo $?

1

=================

let me know, if you need any further information for this.

Re: hive rest api: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)

New Contributor

@Deepesh

Grep command didn't gave any output. Is their a way to confirm the templeton status. Can you suggest further on this.

============

# grep "hive.metastore.uris" webhcat.log ; echo $?

1

==============

Re: hive rest api: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)

Master Collaborator

The status command that you used was fine, unfortunately WebHCat doesn't have any status command specifically for hive REST API call. Perhaps the webhcat.log has rolled over, can you do a directory listing of your webhcat log folder?

Re: hive rest api: java.net.URISyntaxException Malformed escape pair at index 9: thrift://%HOSTGROUP::host_group_master1%:9933)

New Contributor
@Deepesh

Below is the output of grep command in webhcat log directory. Can you kindly suggest further.

/log/webhcat # grep "hive.metastore.uris" *

webhcat.log.2017-03-29:templeton.hive.properties=hive.metastore.local=false, hive.metastore.uris=thrift://%HOSTGROUP::host_group_master1%:9933, hive.metastore.sasl.enabled=false,hive.metastore.execute.setugi=true,hive.metastore.uris=thrift://m02:9083\,thrift://m01:9083,hive.metastore.sasl.enabled=false,hive.metastore.execute.setugi=true,hive.execution.engine=tez

webhcat.log.2017-03-29:hive.metastore.uris=thrift://m02:9083,thrift://m01:9083

webhcat.log.2017-04-12:templeton.hive.properties=hive.metastore.local=false, hive.metastore.uris=thrift://%HOSTGROUP::host_group_master1%:9933, hive.metastore.sasl.enabled=false, hive.metastore.execute.setugi=true,hive.metastore.uris=thrift://m02:9083\,thrift://m01:9083,hive.metastore.sasl.enabled=false,hive.metastore.execute.setugi=true,hive.execution.engine=tez

webhcat.log.2017-04-12:hive.metastore.uris=thrift://m02:9083,thrift://m01:9083