首页   >   心得技巧

IDEA安装了Translation谷歌翻译插件,但是提示网络异常

公司项目中涉及到国外的业务,所以每次都需要翻译文案,而且平时看源代码,里面的文档也全都是英文的,频繁的打开浏览器来翻译,着实是非常的麻烦。

还好,IDEA提供了谷歌翻译的插件(Translation),很好用,跟在浏览器上打开翻译网站翻译的效果一样:

IDEA安装了Translation谷歌翻译插件,但是提示网络异常

直接安装了一个,但是当我使用的时候却一直提示网络异常,错误信息如下:

>Plugin v2.3.2  
>IntelliJ IDEA 2019.1  
>Build #IU-191.6183.87, built on March 27, 2019  
>JRE: 1.8.0_202-release-1483-b39 x86_64  
>JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o  
>OS: macOS 10.14.4

```
cn.yiiguxing.plugin.translate.trans.TranslateException: Google Translate > 网络异常
        at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:49)
        at cn.yiiguxing.plugin.translate.trans.TranslateService$translate$inlined$executeOnPooledThread$1.run(Applications.kt:169)
        at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:311)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketException: Connection refused (Connection refused)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:435)
        at java.net.Socket.connect(Socket.java:589)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)
        at com.intellij.util.io.HttpRequests.openConnection(HttpRequests.java:615)
        at com.intellij.util.io.HttpRequests.access$300(HttpRequests.java:59)
        at com.intellij.util.io.HttpRequests$RequestImpl.getConnection(HttpRequests.java:383)
        at com.intellij.util.io.HttpRequests$RequestImpl.getInputStream(HttpRequests.java:392)
        at com.intellij.util.io.HttpRequests$RequestImpl.readString(HttpRequests.java:447)
        at cn.yiiguxing.plugin.translate.trans.AbstractTranslator$translate$2.process(AbstractTranslator.kt:45)
        at cn.yiiguxing.plugin.translate.trans.AbstractTranslator$translate$2.process(AbstractTranslator.kt:16)
        at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:528)
        at com.intellij.util.io.HttpRequests.process(HttpRequests.java:504)
        at com.intellij.util.io.HttpRequests.access$100(HttpRequests.java:59)
        at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:357)
        at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:44)
        ... 7 more
```

第一反应是本机是不是断网了,查看之后发现网络并没有问题,可以访问谷歌翻译的网站,而且访问数据库之类的也都是正常的。

紧接着又怀疑是不是因为没翻墙的缘故,因为之前访问谷歌翻译都是使用的http://translate.google.cn,而不是使用的.com,可是检查了之后发现也没问题,不管是.cn还是.com,本机都是可以访问的。

无奈之下重启IDEA,竟然还是不行,打开之后依旧说网络异常,真的是让我非常生气,甚至都想要卸载这个破插件了。

抱着最后一丝希望,憋了个大招:重启电脑,没想到问题竟然解决了,重启之后再次打开IDEA就正常了,就算我将VPN关了也依旧还是可以使用插件进行翻译。

什么也没做,问题就这么好了,莫名其妙,真的是奇了个怪!!!

QQ群: 686430774

站长Q: 1347384268

分享到:

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

欢迎分享本文,转载请注明出处!

作者:不忘初心

发布时间:2019-04-04

永久地址:https://www.jiweichengzhu.com/article/d7742f01630e4a2397760f83b042792a

评论