Question

I recently found a very useful code over the web for twitter tweets analysis and telling about the events going to happen.

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

I tried to run this code by following the instructions in the section "how to run" but i got the errors in command line as in attached picture . Can anyone please why it is coming.??

[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>
Was it helpful?

Solution

In the README.md it is written: You need to fill in the twitter4j.properties file with your own credentials. The Java application cannot find the file and a NPE is returned.
(in is null and prop.load(in) generates a NPE!)
Crawler.java:

  try {
      InputStream in = Crawler.class.getClassLoader()
              .getResourceAsStream("twitter4j.properties");
      prop.load(in);
  } catch (IOException e) {
      log.error(e.toString());
  }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top