运行hadoop 报错Error: java.lang.ArrayIndexOutOfBoundsException: 1,感觉程序没问题

public class HH {
    public static class HHMapper extends Mapper<LongWritable,Text,Text,IntWritable>{
        private Text map_key=new Text();
        private IntWritable map_value=new IntWritable();
        protected void map(LongWritable key,Text value,Context context) throws IOException,InterruptedException{
            //System.out.println(value.toString());
            String[] H=value.toString().split("\t");
            String[] h=H[1].split(",");
                    int[][] R=new int[h.length][h.length];

                    for(int i=0;i<h.length;i++)
                        for(int j=0;j<h.length;j++){
                            R[i][j]=Integer.parseInt(h[i])*Integer.parseInt(h[j]);
                            map_key.set(H[0]+","+j);
//                          map_key.set(H[0]);
                            map_value.set((R[i][j]));
//                          map_value.set(1);
                            context.write(map_key, map_value);
            }

        }
    }

感觉程序没问题 就是报下标越界错误,文件格式也没问题啊

查看全部
fantasy_4
fantasy_4
2019/04/17 10:35
  • java
  • 神经网络
  • eclipse
  • 点赞
  • 收藏
  • 回答
    私信

0个回复