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

Johannes Zillmann commented on TEZ-1818:
----------------------------------------

I'm not exactly sure why there is a difference in the path between the 2 way of 
loading something from classpath. But without the leading '/' it will not work, 
that was my first attempt!
Could imagine the with the class loader approach you always start at the root 
level, whereas with the class approach the working folder is the location of 
the class...

> Problem loading tez-api-version-info.properties in case current context 
> classloader in not pointing to Tez jars
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: TEZ-1818
>                 URL: https://issues.apache.org/jira/browse/TEZ-1818
>             Project: Apache Tez
>          Issue Type: Bug
>    Affects Versions: 0.5.2
>            Reporter: Johannes Zillmann
>            Assignee: Johannes Zillmann
>         Attachments: TEZ-1818.1-branch0.5.2.patch
>
>
> TEZ-1664 (0.5.2) introduced loading of tez-api-version-info.properties which 
> is packaged within the tez-api.jar. Its using the current context classloader 
> to load it:
> {code}
> Thread.currentThread().getContextClassLoader()
>           .getResourceAsStream(versionInfoFile);
> {code}
> In our environment we load the tez code as a plugin. Our context classloader 
> doesn't have any reference to the Tez code. Thus when instantiating the tez 
> client there is this exception:
> {code}
>  WARN [2014-12-03 17:30:30.971] (VersionInfo.java:60) - Could not read 
> 'tez-api-version-info.properties', java.io.IOException: Resource not found
> java.io.IOException: Resource not found
>       at org.apache.tez.common.VersionInfo.<init>(VersionInfo.java:56)
>       at 
> org.apache.tez.client.TezApiVersionInfo.<init>(TezApiVersionInfo.java:26)
>       at org.apache.tez.client.TezClient.<init>(TezClient.java:137)
>       at org.apache.tez.client.TezClient.create(TezClient.java:213)
>         ....
> {code}
> Is there any specific reason the context classloader is used to load the file 
> ?
> Since the properties file is usually bundled within the jar would 
> TezApiVersionInfo.class.getResourceAsStream() not be a better fit ?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to