Reputation: 341
I wrote hadoop the program with use of log4j and I give its part
package org.myorg;
import java.io.*;
import java.util.*;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.*;
import org.apache.hadoop.util.*;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.log4j.xml.DOMConfigurator;
public class ParallelIndexation {
//public static native long Traveser(String Path);
//public static native void Configure(String Path);
//static {
// System.loadLibrary("nativelib");
//}
public static class Map extends MapReduceBase implements
Mapper<LongWritable, Text, Text, LongWritable> {
private final static LongWritable zero = new LongWritable(0);
private Text word = new Text();
private static final Logger logger = LogManager.getLogger(Map.class.getName());
DOMConfigurator.configure("/export/hadoop-1.0.1/log4j.xml");
I tried to compile the hadoop-program by means of a command
root@one:/opt/jdk1.7.0_06/bin#. / javac - classpath/export/hadoop-1.0.1/hadoop-core-1.0.1.jar:/export/hadoop-1.0.1/log4j-1.2.17.jar - d/folder/classes/folder/src/ParallelIndexation.java
also I received as a result the following error messages
/folder/src/ParallelIndexation.java:27: error: <identifier> expected
DOMConfigurator.configure("/export/hadoop-1.0.1/log4j.xml");
^
/folder/src/ParallelIndexation.java:27: error: illegal start of type
DOMConfigurator.configure("/export/hadoop-1.0.1/log4j.xml");
^
2 errors
Help to eliminate these errors.
Upvotes: 0
Views: 203
Reputation: 159844
The statement
DOMConfigurator.configure("/export/hadoop-1.0.1/log4j.xml");
should be in a method (or constructor or static
initializer)
rather than in the class block of Map
Upvotes: 1