能够在一个系统上运行java应用程序,但不能在其他系统上运行

时间:2013-11-22 15:58:14

标签: java swing java-7 twitter4j

我的java swing应用程序遇到了一个奇怪的情况。在我的电脑(win-7 x64和jre-7)中,它运行正常。我能够在我的系统上运行jar文件,但是在安装了jre7的windows xp机器上,它提供了以下错误跟踪:

C:\Documents and Settings\HOME\Desktop\TweetTweetAsMuchYouTweet_jar>java -jar Tw
eetTweetAsMuchYouTweet.jar
401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing
or incorrect. Ensure that you have set valid consumer key/secret, access token/
secret, and the system clock is in sync.
Failed to validate oauth signature and token

Relevant discussions can be found on the Internet at:
        http://www.google.co.jp/search?q=10f5ada3 or
        http://www.google.co.jp/search?q=0276a2ab
TwitterException{exceptionCode=[10f5ada3-0276a2ab], statusCode=401, message=null
, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.5}
        at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:16
2)
        at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.j
ava:61)
        at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java
:98)
        at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthoriza
tion.java:122)
        at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthoriza
tion.java:104)
        at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:2
98)
        at Account.getAccessTokenAfterAuthentication(Account.java:45)
        at Account.<init>(Account.java:33)
        at AddFormWin$1.actionPerformed(AddFormWin.java:75)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$200(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

如果我们注意到这一行:

Authentication credentials (https://dev.twitter.com/pages/auth) were missing
or incorrect. Ensure that you have set valid consumer key/secret, access token/
secret, and the system clock is in sync.
Failed to validate oauth signature and token

由于无效的消费者密钥/密钥,身份验证失败。但是为什么Windows 7机器上的同一个应用程序运行得很好?

请注意,在我的应用中,我使用Twitter4j(v-3.0.5)使用oob(PIN based)身份验证。

作为一名java开发人员,我对此感到非常惊讶,因为java因其平台独立性而闻名。那么java的平台独立性有什么问题吗?

1 个答案:

答案 0 :(得分:0)

这看起来不像Java VM或Windows OS问题。我怀疑与oob实现有关或输入了错误的PIN。我假设需要为每台机器输入PIN。