I am implementing OAuth using twitter4j for a Google App Engine (GAE) app in Java, developing on a Mac in Eclipse. I got the following error when I was testing the login:
Problem accessing /signintwitter. Reason:
java.lang.IllegalAccessException: Class com.google.appengine.tools.development.agent.runtime.Runtime can not
access a member of class twitter4j.conf.PropertyConfigurationFactory with modifiers "" Caused by:
java.lang.AssertionError: java.lang.IllegalAccessException: Class com.google.appengine.tools.development.agent.runtime.Runtime can not access a member of class twitter4j.conf.PropertyConfigurationFactory with modifiers "" at twitter4j.conf.ConfigurationContext.(ConfigurationContext.java:47) at twitter4j.TwitterFactory.(TwitterFactory.java:39) at audienceinsights.server.authentication.twitter.SigninServlet.doGet(SigninServlet.java:29)
I searched StackOverflow for similar errors but couldn't find any answers.
According to https://groups.google.com/forum/#!msg/twitter4j/a-VFnkmv_iE/-py4lUS5v7sJ the solution is to upgrade to 1.7.0_40. That post is a little old so I upgraded to the current latest Java 1.7 which is 1.7.0_67. That fixed the problem.
Steps to fix on a Mac in Eclipse Luna Release (4.4.0):
1] Download Java 1.7.0_67 from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html, and double click the download to follow the installation instructions (take all the defaults).
2] In Eclipse go to Eclipse => Preferences (Command + ,)
3] Navigate to Java => Installed JREs
4] Click Add
5] Select Standard VM, click Next
6] For the field JRE Home, click the "Directory..." button
7] Navigate to \Library\Java\JavaVirtualMachines\jdk1.7.0_67.jdk\Contents\Home\jre, click Open
8] In the JRE Name field it might say Home but I renamed mine to "Java SE 7 [1.7.0_67]"
9] Click Finish (This takes you back to the screen in Preferences at Java => Installed JREs)
10] Put a checkmark next to your newly installed JRE (in my case "Java SE 7 [1.7.0_67]" because that's what I named it in step 8)
11] Refresh your Eclipse project by going to File => Refresh
Once I performed the steps above, I was able to avoid the error message reported in the original problem.