【问题标题】:Spring OAuth in Google App Engine failsGoogle App Engine 中的 Spring OAuth 失败
【发布时间】:2015-05-14 19:37:23
【问题描述】:

我正在尝试使用这样的 Spring Security 实现 OAuth1.0:

@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public RestOperations twitterOAuthRestTemplate() {
    return new OAuthRestTemplate(twitterOAuthDetails());
}

但它在运行时失败:

jjava.lang.NoClassDefFoundError: java.net.ProxySelector is a restricted class. Please see the Google  App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at org.springframework.security.oauth.consumer.client.CoreOAuthConsumerSupport.<init>(CoreOAuthConsumerSupport.java:64)
at org.springframework.security.oauth.consumer.client.OAuthRestTemplate.<init>(OAuthRestTemplate.java:17)
at org.springframework.security.oauth.consumer.client.OAuthRestTemplate.<init>(OAuthRestTemplate.java:20)

有人知道怎么解决吗?

【问题讨论】:

    标签: java spring google-app-engine oauth spring-security


    【解决方案1】:

    我没有找到比创建自己的 Spring 类(OAuthRestTemplate、CoreOAuthConsumerSupport)副本并摆脱 ProxySelector 更好的方法。

    【讨论】:

      猜你喜欢
      • 2013-12-09
      • 1970-01-01
      • 2014-05-12
      • 2020-06-02
      • 2013-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多