[ 
https://issues.apache.org/jira/browse/HIVE-23700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17136052#comment-17136052
 ] 

Francisco Guerrero commented on HIVE-23700:
-------------------------------------------

Attached a patch to fix the issue. The patch handles IllegalArgumentExceptions 
thrown by the File constructor when the jar URI is not supported. This fixes 
the static initialization of the HiveConf class when four conditions are met:

1. hive-site.xml is not present on the classpath
2. hive-site.xml is not present on the "HIVE_CONF_DIR" directory
3. hive-site.xml is not present on the "HIVE_HOME" directory
4. jar URI is not absolute, or is opaque, or URI scheme is null or not file, 
uri authority is not null, uri fragment is not null, uri query is not null and 
finally uri path is empty.

> HiveConf static initialization fails when JAR URI is opaque
> -----------------------------------------------------------
>
>                 Key: HIVE-23700
>                 URL: https://issues.apache.org/jira/browse/HIVE-23700
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 3.1.2, 2.3.7
>            Reporter: Francisco Guerrero
>            Priority: Minor
>         Attachments: HIVE-23700.1.patch
>
>   Original Estimate: 120h
>  Remaining Estimate: 120h
>
> HiveConf static initialization fails when the jar URI is opaque, for example 
> when it's embedded as a fat jar in a spring boot application. Then 
> initialization of the HiveConf static block fails and the HiveConf class does 
> not get classloaded. The opaque URI in my case looks like this 
> _jar:file:/usr/local/server/some-service-jar.jar!/BOOT-INF/lib/hive-common-2.3.7.jar!/_
> HiveConf#findConfigFile should be able to handle `IllegalArgumentException` 
> when the jar `URI` provided to `File` throws the exception.
> To surface this issue three conditions need to be met.
> 1. hive-site.xml should not be on the classpath
> 2. hive-site.xml should not be on "HIVE_CONF_DIR"
> 3. hive-site.xml should not be on "HIVE_HOME"



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to