java RMI问题
以下是连接报错问题。。这个是我的命名绑定语句Naming.bind("/localhost:3000/getStudent",obj);Connectionrefused...
以下是连接报错问题。。
这个是我的命名绑定语句 Naming.bind("/localhost:3000/getStudent", obj);
Connection refused to host: 172.30.34.59; nested exception is:
java.rmi.ConnectException: Connection refused to host: 172.30.34.59; nested exception is:
java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at java.rmi.Naming.bind(Naming.java:111)
at customerandsever.provideStudentImpl.main(provideStudentImpl.java:27)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
... 6 more 展开
这个是我的命名绑定语句 Naming.bind("/localhost:3000/getStudent", obj);
Connection refused to host: 172.30.34.59; nested exception is:
java.rmi.ConnectException: Connection refused to host: 172.30.34.59; nested exception is:
java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at java.rmi.Naming.bind(Naming.java:111)
at customerandsever.provideStudentImpl.main(provideStudentImpl.java:27)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
... 6 more 展开
3个回答
展开全部
rmiregistry的默认端口是1099....你这里指定的端口是3000
所以你在CMD中要这样 start rmiregistry 3000
或者将你的Naming.bind("/localhost:3000/getStudent", obj);
改为Naming.bind("rmi://localhost:1099/getStudent", obj);
额,突然发现你没有在前面加rmi前缀...不知道这个有关系没~~~~
额,查了下,不加rmi前缀也可以,加了rmi前缀后会如果你没有指定端口就会将obj注册到主机上监听1099端口的rmiregistry进程上去...
如果还出现错误就不知道了
所以你在CMD中要这样 start rmiregistry 3000
或者将你的Naming.bind("/localhost:3000/getStudent", obj);
改为Naming.bind("rmi://localhost:1099/getStudent", obj);
额,突然发现你没有在前面加rmi前缀...不知道这个有关系没~~~~
额,查了下,不加rmi前缀也可以,加了rmi前缀后会如果你没有指定端口就会将obj注册到主机上监听1099端口的rmiregistry进程上去...
如果还出现错误就不知道了
展开全部
试楼上的吧,你这个就是没有连接成功,你说172.30.34.59是本机,那就有可能是端口错误了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你先PING一下172.30.34.59这台电脑吧,你们连接都没有通啊
追问
这个就是本机localhost啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询