在java版本的demo中:
String accessToken = AuthHelper.
getAccessToken()
;
但是如果在开发中,我们是通过代理上网的,会抛出:
java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy4.getCorpToken(Unknown Source)
at com.alibaba.dingtalk.openapi.demo.auth.AuthHelper.getAccessToken(AuthHelper.java:44)
at com.csair.excel.DemoTest.main(DemoTest.java:15)
Caused by: java.net.ConnectException: connection timed out: oapi.dingtalk.com/106.11.68.3:443
at com.ning.http.client.providers.netty.request.NettyConnectListener.onFutureFailure(NettyConnectListener.java:133)
at com.ning.http.client.providers.netty.request.NettyConnectListener.operationComplete(NettyConnectListener.java:145)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:409)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:400)
at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:362)
at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:142)
at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:83)
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.netty.channel.ConnectTimeoutException: connection timed out: oapi.dingtalk.com/106.11.68.3:443
at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:139)
... 8 more
这个需要设置代理,但是在程序中:
类[size=; font-size: 11.3pt,11.3pt]
getAccessToken:
accToken = corpConnectionService.getCorpToken(Env.
CORP_ID
, Env.
CORP_SECRET)
;
我们如何设置自己的代理连接获得accesstoken呢?不解,请各位大神指点,谢谢!!!
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。