You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by rob parker <ro...@gmail.com> on 2011/11/04 16:33:21 UTC

Determining cause of UDF exception

I have a UDF to output JSON. (PIG v0.9.1, Hadoop 0.20.204)

I have tested the setup outside of pig and Jackson will produce a JSON
string.

However in the UDF I am getting:

ERROR 2997: Unable to recreate exception from backed error: Error:
org.codehaus.jackson.map.ObjectMapper.writeValueAsString(Ljava/lang/Object;)Ljava/lang/String;

in the putNext(Tuple t) function:

the aky object is POJO, and I have tested the hardcoded setup (which is
also used in the UDF for now) in a separate Java main block it eliminate
the extreme obvious.

I have tried to rethrow a PigException to get some idea of which exception
is causing the issue.

                        ObjectMapper mapper = new ObjectMapper();
String jsonOutput = null;
try {
jsonOutput = mapper.writeValueAsString(aky);
Text text = new Text(jsonOutput);
writer.write(null, text);
} catch (JsonGenerationException e) {
 e.printStackTrace();
throw new PigException(e);
} catch (JsonMappingException e) {
 e.printStackTrace();
throw new PigException(e);
} catch (IOException e) {
 e.printStackTrace();
throw new PigException(e);
                        }

Anyway to determine the actual exception or the root cause?

thanks,

rob

Re: Determining cause of UDF exception

Posted by Dmitriy Ryaboy <dv...@gmail.com>.
What does the failed map task log say?

On Fri, Nov 4, 2011 at 8:33 AM, rob parker <ro...@gmail.com> wrote:

> I have a UDF to output JSON. (PIG v0.9.1, Hadoop 0.20.204)
>
> I have tested the setup outside of pig and Jackson will produce a JSON
> string.
>
> However in the UDF I am getting:
>
> ERROR 2997: Unable to recreate exception from backed error: Error:
>
> org.codehaus.jackson.map.ObjectMapper.writeValueAsString(Ljava/lang/Object;)Ljava/lang/String;
>
> in the putNext(Tuple t) function:
>
> the aky object is POJO, and I have tested the hardcoded setup (which is
> also used in the UDF for now) in a separate Java main block it eliminate
> the extreme obvious.
>
> I have tried to rethrow a PigException to get some idea of which exception
> is causing the issue.
>
>                        ObjectMapper mapper = new ObjectMapper();
> String jsonOutput = null;
> try {
> jsonOutput = mapper.writeValueAsString(aky);
> Text text = new Text(jsonOutput);
> writer.write(null, text);
> } catch (JsonGenerationException e) {
>  e.printStackTrace();
> throw new PigException(e);
> } catch (JsonMappingException e) {
>  e.printStackTrace();
> throw new PigException(e);
> } catch (IOException e) {
>  e.printStackTrace();
> throw new PigException(e);
>                        }
>
> Anyway to determine the actual exception or the root cause?
>
> thanks,
>
> rob
>

Re: Determining cause of UDF exception

Posted by pablomar <pa...@gmail.com>.
i use
catch(Exception e) {
throw WrappedIOException.wrap("you message " + e.getMessage(), e);



On 11/4/11, rob parker <ro...@gmail.com> wrote:
> I have a UDF to output JSON. (PIG v0.9.1, Hadoop 0.20.204)
>
> I have tested the setup outside of pig and Jackson will produce a JSON
> string.
>
> However in the UDF I am getting:
>
> ERROR 2997: Unable to recreate exception from backed error: Error:
> org.codehaus.jackson.map.ObjectMapper.writeValueAsString(Ljava/lang/Object;)Ljava/lang/String;
>
> in the putNext(Tuple t) function:
>
> the aky object is POJO, and I have tested the hardcoded setup (which is
> also used in the UDF for now) in a separate Java main block it eliminate
> the extreme obvious.
>
> I have tried to rethrow a PigException to get some idea of which exception
> is causing the issue.
>
>                         ObjectMapper mapper = new ObjectMapper();
> String jsonOutput = null;
> try {
> jsonOutput = mapper.writeValueAsString(aky);
> Text text = new Text(jsonOutput);
> writer.write(null, text);
> } catch (JsonGenerationException e) {
>  e.printStackTrace();
> throw new PigException(e);
> } catch (JsonMappingException e) {
>  e.printStackTrace();
> throw new PigException(e);
> } catch (IOException e) {
>  e.printStackTrace();
> throw new PigException(e);
>                         }
>
> Anyway to determine the actual exception or the root cause?
>
> thanks,
>
> rob
>