Как запустить код в Maven для твиттера

1

Недавно я нашел очень полезный код в Интернете для анализа твитов твиттов и рассказал о событиях, которые произойдут.

https://github.com/mvogiatzis/first-stories-twitter#implementation-summary

Я попытался запустить этот код, выполнив инструкции в разделе "Как запустить", но я получил ошибки в командной строке, как показано на рисунке. Может кто угодно, почему это происходит?

[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ First-Story-Detection >>
>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ First-Story-Detection <<
<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ First-Story-Detection --
-
[WARNING]
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException
        at java.util.Properties$LineReader.readLine(Properties.java:434)
        at java.util.Properties.load0(Properties.java:353)
        at java.util.Properties.load(Properties.java:341)
        at crawler.Crawler.main(Crawler.java:100)
        ... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.421 s
[INFO] Finished at: 2014-04-23T17:04:44+05:00
[INFO] Final Memory: 11M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (d
efault-cli) on project First-Story-Detection: An exception occured while executi
ng the Java class. null: InvocationTargetException: NullPointerException -> [Hel
p 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
E:\Course\FYP\Working\After mid defense\Twitter Service\first-stories-twitter-ma
ster\first-stories-twitter-master>
Теги:
maven
twitter
twitter4j

1 ответ

1
Лучший ответ

В README.md написано: вам нужно заполнить файл twitter4j.properties собственными учетными данными. Приложение Java не может найти файл, и возвращается NPE.
(in - null и prop.load(in) генерирует NPE!)
Crawler.java:

  try {
      InputStream in = Crawler.class.getClassLoader()
              .getResourceAsStream("twitter4j.properties");
      prop.load(in);
  } catch (IOException e) {
      log.error(e.toString());
  }

Ещё вопросы

Сообщество Overcoder
Наверх
Меню