[ 
https://issues.apache.org/jira/browse/MAPREDUCE-1686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12893217#action_12893217
 ] 

Paul Burkhardt commented on MAPREDUCE-1686:
-------------------------------------------

I attached a new patch to remove the printStackTrace() call in accordance to 
MAPREDUCE-571. Note that the pre-patched version will fail with a Java stack 
trace for ClassNotFoundException because it is thrown outside the method.

I ran both the ant test and ant test-patch targets with success because the 
testjar is created in the compile-core-test target. I need more information to 
understand your request.

The loadLibJar() and assert mentioned in your third comment is there to abort 
the unit test if the classpath is not properly loaded. Otherwise it may not be 
clear that the unit test failed because there was an issue in the configuration 
of the unit test. Let me know if you still want me to remove the assertion.

Thank you for the comments.

> ClassNotFoundException for custom format classes provided in libjars
> --------------------------------------------------------------------
>
>                 Key: MAPREDUCE-1686
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-1686
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>          Components: contrib/streaming
>    Affects Versions: 0.20.1
>            Reporter: Paul Burkhardt
>            Priority: Minor
>         Attachments: HADOOP-1686-1.patch, HADOOP-1686.patch
>
>
> The StreamUtil::goodClassOrNull method assumes user-provided classes have 
> package names and if not, they are part of the Hadoop Streaming package. For 
> example, using custom InputFormat or OutputFormat classes without package 
> names will fail with a ClassNotFound exception which is not indicative given 
> the classes are provided in the libjars option. Admittedly, most Java 
> packages should have a package name so this should rarely come up.
> Possible resolution options:
> 1) modify the error message to include the actual classname that was 
> attempted in the goodClassOrNull method
> 2) call the Configuration::getClassByName method first and if class not found 
> check for default package name and try the call again
> {code}
>     public static Class goodClassOrNull(Configuration conf, String className, 
> String defaultPackage) {
>         Class clazz = null;
>         try {
>             clazz = conf.getClassByName(className);
>         } catch (ClassNotFoundException cnf) {
>         }
>         if (clazz == null) {
>             if (className.indexOf('.') == -1 && defaultPackage != null) {
>                 className = defaultPackage + "." + className;
>                 try {
>                     clazz = conf.getClassByName(className);
>                 } catch (ClassNotFoundException cnf) {
>                 }
>             }
>         }
>         return clazz;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to