Hi Guys,

Was going through the main tutorial with a student today and ran into a
ClassCastException, which I have appended to this thread. This is
encountered in most recent trunk when attempting to run a parse with the
logmanager, having already compiled the Avro schema and defined the mapping.

Please correct me if I'm not seeing this clearly, but does the parse method
not try to read the String line, which is specified in both
gora-hbase-mapping and gora-sql-mapping.xml as keyClass="java.lang.Long".
Is it here, or somewhere else that there is a mismatch in data types?

Thanks

  /**
   * Parses a log file and store the contents at the data store.
   * @param input the input file location
   */
  private void parse(String input) throws IOException, ParseException {
    log.info("Parsing file:" + input);
    BufferedReader reader = new BufferedReader(new FileReader(input));
    long lineCount = 0;
    try {
      String line = reader.readLine();
      do {
        Pageview pageview = parseLine(line);

        if(pageview != null) {
          //store the pageview
          storePageview(lineCount++, pageview);
        }

        line = reader.readLine();
      } while(line != null);

    } finally {
      reader.close();
    }
    log.info("finished parsing file. Total number of log lines:" +
lineCount);
  }



lewis@lewis-desktop:~/ASF/gora_trunk$ bin/gora logmanager -parse
gora-tutorial/src/main/resources/access.log
Exception in thread "main" java.lang.ClassCastException: java.lang.Long
cannot be cast to java.lang.String
    at org.apache.gora.mock.store.MockDataStore.put(MockDataStore.java:36)
    at
org.apache.gora.tutorial.log.LogManager.storePageview(LogManager.java:140)
    at org.apache.gora.tutorial.log.LogManager.parse(LogManager.java:91)
    at org.apache.gora.tutorial.log.LogManager.main(LogManager.java:240)


-- 
*Lewis*

Reply via email to