gpt4 book ai didi

java - twitter4j 3.0.3 - 更新状态错误 404 - 仅发生在生产中

转载 作者:太空宇宙 更新时间:2023-11-04 15:21:08 24 4
gpt4 key购买 nike

使用 twitter4j 3.0.3 通过 Web 应用程序更新 twitter 状态时出现奇怪的错误。

当我在开发环境中运行我的应用程序时,它可以成功更新状态。但是当我将应用程序部署并运行到生产环境后,它无法更新任何状态。

应用程序应该是相同的。我不确定我的生产环境是否存在网络问题。或者 Twitter 可能只授权一台机器(开发)中的一个应用程序并将其锁定在其他机器(产品)上?

我所知道的是它给出了以下错误消息:

2013-12-04 06:18:39 ERROR TwitterServiceImpl:68 - 404:The URI requested is invalid or the resource requested, such as a user, does not exists. Also returned when the requested format is not supported by the requested method.
<html><head><title>Apache Tomcat/7.0.40 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /1.1/statuses/update.json</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/1.1/statuses/update.json</u></p><p><b>description</b> <u>The requested resource is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.40</h3></body></html>

Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=b2b52c28 or
http://www.google.co.jp/search?q=10981ab8
TwitterException{exceptionCode=[b2b52c28-10981ab8], statusCode=404, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.3}

我已在 dev.twitter.com 上创建了应用程序,并将访问权限设置为“读取、写入和访问直接消息”。我还使用应用程序详细信息页面中提供的消费者 key 、消费者 secret 、访问 token 和访问 token secret 。

这是我的java代码:

@Override
public void updateStatus(String message) throws BusinessException {
try {
ConfigurationBuilder confbuilder = new ConfigurationBuilder();
confbuilder.setOAuthAccessToken(TWITTER_ACCESS_TOKEN)
.setOAuthAccessTokenSecret(TWITTER_ACCESS_TOKEN_SECRET)
.setOAuthConsumerKey(TWITTER_CONSUMER_KEY)
.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);
Twitter twitter = new TwitterFactory(confbuilder.build()).getInstance();

Status status = twitter.updateStatus(message);
logger.info("Successfully updated the status to [" + status.getText() + "].");
} catch (Exception e) {
logger.error(e);
throw new BusinessException(e.getMessage());
}
}

大家有什么想法吗?

最佳答案

确保您输入的 key 正确,并且您的时间戳采用 UTC 格式并且与我们的时间戳相差几分钟之内。

关于java - twitter4j 3.0.3 - 更新状态错误 404 - 仅发生在生产中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20370710/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com