Liubsyy / HotSecondsIDEA

HotSeconds是一款Java远程热部署的插件,可实现秒级一键化热更新。插件分为HotSecondsClient(IDEA热部署插件)和HotSecondsServer(服务端javaagent热更新插件),可以热更新java和常用配置文件,也支持常用框架(Spring,MyBatis)的热更新,相对传统部署可节省大量时间提高开发效率。
GNU General Public License v2.0
378 stars 49 forks source link

热部署失败 #16

Closed lijunjie1991 closed 11 months ago

lijunjie1991 commented 1 year ago

我配置的连接ip地址是服务器的外网ip地址,但是这个报错里面是服务器的内网ip地址

image

报错中10.10.0.82是我的服务器的内网ip地址

能不能提供一下HotDeployClient这个类的源码看一看。。

[14:22:51] Failed to initialize IHotDeployService:java.rmi.ConnectException: Connection refused to host: 10.10.0.82; nested exception is: 
    java.net.ConnectException: Operation timed out
    at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:626)
    at java.rmi/sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:217)
    at java.rmi/sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:204)
    at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
    at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:215)
    at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:160)
    at jdk.proxy16/jdk.proxy16.$Proxy292.hello(Unknown Source)
    at com.liubs.ff.hotdeploy.HotDeployClient.lambda$initHotDeployConnectAsync$2(HotDeployClient.java:94)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.net.ConnectException: Operation timed out
    at java.base/sun.nio.ch.Net.connect0(Native Method)
    at java.base/sun.nio.ch.Net.connect(Net.java:579)
    at java.base/sun.nio.ch.Net.connect(Net.java:568)
    at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:593)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
    at java.base/java.net.Socket.connect(Socket.java:633)
    at java.base/java.net.Socket.connect(Socket.java:583)
    at java.base/java.net.Socket.<init>(Socket.java:507)
    at java.base/java.net.Socket.<init>(Socket.java:287)
    at com.intellij.execution.rmi.RemoteServer$1.createSocket(RemoteServer.java:156)
    at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:620)
    ... 9 more
Liubsyy commented 1 year ago

一般来说直接填内网ip就行,如果你一定要通过外网访问,可以在服务端加上-Djava.rmi.server.hostname=外网ip,这样客户端就直接和外网ip通信了,另外要确保外网端口能映射到内网的端口

Liubsyy commented 1 year ago

另外服务器包也需要升级到HotSecondsServer-future2版本

c0febean commented 1 year ago

不知道题主按照作者的方式解决没有, 这个报错我也遇到过, 我是在wsl里运行的服务端, 连接出现该异常后, 修改了hostname 相关的映射就好了, 参照这个 https://blog.csdn.net/chenchaofuck1/article/details/51558995

nanxing7 commented 1 year ago

不知道题主按照作者的方式解决没有, 这个报错我也遇到过, 我是在wsl里运行的服务端, 连接出现该异常后, 修改了hostname 相关的映射就好了, 参照这个 https://blog.csdn.net/chenchaofuck1/article/details/51558995

感谢 , 通过 hotsname -i 查看到 ip 是 127.0.0.1 通过 hostname 查看到 hostname 是 debian , 我就去 /etc/hosts 目录下把 127.0.0.1 deian 改为 外网 IP debian 就可以连上了