java 拒绝连接_连接拒绝[Tarantool java客户端]

2022-04-14 00:00:00 专区 订阅 连接 付费 当我

当我尝试连接到tarantool服务器时,我收到以下错误:

线程“main”中的异常java.net.ConnectException:连接被拒绝:在java.net.DualStackPlainSocketImpl.smplConnect(DualStackPlainSocketImpl.java:79)的java.net.AualStackPocketSmplImpl.mpl上连接java.net.DualStackPlainSocketImpl.connect0(连接) .doConnect(AbstractPlainSocketImpl.java:350)java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206),java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188),java.net.PlainSocketImpl.connect(PlainSocketImpl . java:172)at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)at java.net.Socket.connect(Socket.java:589)at java.net.Socket.connect(Socket.java:538)at at java.net.Socket . (Socket.java:434)at java.net.Socket . (Socket.java:211)at TarantoolKt.main(Tarantool.kt:37)

我的代码:

class Tarantool {undefined

val client: TarantoolClient

init {undefined

val config: TarantoolClientConfig = TarantoolClientConfig()

config.apply {undefined

username = "test"

password = "test"

}

val socketChannelProvider: SocketChannelProvider = SocketChannelProvider { _, p1 ->

when(p1) {undefined

null -> {undefined

println("Trying to connect . . .")

SocketChannel.open(InetSocketAddress("192.168.1.254", 3301)) //

}

else -> {undefined

p1.printStackTrace(System.out)

null!!

}

}

}

client = TarantoolClientImpl(socketChannelProvider, config)

}

}

fun main(args: Array): Unit {undefined

val client: Tarantool = Tarantool()

println(client.client.isAlive)

}

当我尝试使用不同的ip时,我得到了同样的错误

我还使用以下命令创建了测试用户:

box.schema.user.create('test', { password = 'test' })

box.schema.user.grant('test', 'execute,read,write', 'universe')

我使用docker for tarantool,我试图从Windows 7 cmd ping IP并且它可以工作 .

谢谢!
————————————————
版权声明:本文为CSDN博主「weixin_39941859」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_39941859/article/details/115041500

相关文章