Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 内部服务器的tomcat7配置导致Oauth生产者问题_Java_Tomcat_Oauth 2.0_Authorization_Token - Fatal编程技术网

Java 内部服务器的tomcat7配置导致Oauth生产者问题

Java 内部服务器的tomcat7配置导致Oauth生产者问题,java,tomcat,oauth-2.0,authorization,token,Java,Tomcat,Oauth 2.0,Authorization,Token,我作为制作人与Oauth合作。我想要的是,当用户从我的系统登录时,如果他/她是授权用户,他/她应该获得访问令牌。身份验证过程将通过请求令牌完成。现在,当我调用getRequestToken()时,代码出现了问题。由于我的程序已成功连接到我提供的sitename/IP地址,但它在tomcat7中执行时导致了问题。 我在这里张贴我的代码 OAuthConfig config; DefaultApi10a api; public static void main(String[] args) {

我作为制作人与Oauth合作。我想要的是,当用户从我的系统登录时,如果他/她是授权用户,他/她应该获得访问令牌。身份验证过程将通过请求令牌完成。现在,当我调用getRequestToken()时,代码出现了问题。由于我的程序已成功连接到我提供的sitename/IP地址,但它在tomcat7中执行时导致了问题。 我在这里张贴我的代码

OAuthConfig config;
DefaultApi10a api;

public static void main(String[] args) {
    OAuthService service = new ServiceBuilder().provider(OauthAsServerApi.class)
          .ap Key(nonce).apiSecret(nonce).callback("some IP address").build();

    Token requestToken = service.getRequestToken();

    System.out.println(requestToken.toString());
    Scanner in = new Scanner(System.in);

    Verifier verifier = new Verifier(in.next());

    // Trade the Request Token and Verifier for the Access Token
    Token accessToken = service.getAccessToken(requestToken, verifier);
    OAuthRequest request = new OAuthRequest(Verb.POST,
                PROTECTED_RESOURCE_URI);
    request.addBodyParameter("param", "value");
    service.signRequest(accessToken, request);
    Response response = request.send();
    System.out.println(response.getBody());
    }
当我执行此操作时,出现以下错误:

Exception in thread "main" org.scribe.exceptions.OAuthException: Response body is incorrect. Can't extract token and secret from this: '<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 - /auth/oauth/v1/request</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/auth/oauth/v1/request</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>'
    at org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:41)
    at org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:27)
    at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:52)
    at com.oauth.OauthAsServer.main(OauthAsServer.java:37)
线程“main”org.scribe.exceptions.oautheexception:响应正文中的异常不正确。无法从此中提取令牌和机密:“Apache Tomcat/7.0.40-错误报告HTTP Status 404-/auth/oauth/v1/request
键入状态报告

消息/auth/oauth/v1/request

说明请求的资源不可用。


Apache Tomcat/7.0.40” 位于org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:41) 位于org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:27) 位于org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:52) 位于com.oauth.OauthAsServer.main(OauthAsServer.java:37) 这里的主要问题是由于tomcat7。无法使用外部主机名(远程站点)


有人能帮我解决这个问题吗???

您的请求得到了404。没有。我没有收到404请求。问题与tomcat7No外部主机有关。现在我收到Http 500错误。实际上,Tomcat server7.0错误是由于我解决的另一个原因造成的。我收到http 404错误,因为系统无法找到我的请求\u令牌\u资源路径,正如我提到的api文件。我也解决了这个问题。现在它正在连接到所需的站点并显示整个页面,但出现了错误:org.scribe.exceptions.oautheexception:Response body不正确。无法从此中提取令牌和密码:'您能建议我如何解决此http 500错误吗?