Closed Rod-fish closed 2 years ago
server_uri无效,请将server_uri配置为localhost:33333
十分抱歉,这里是我自己的疏忽,没有看见这里参数要求,目前我已经补齐了参数,还是无法连接服务器 这里是bot的日志等数据
10-09 15:38:17 [SUCCESS] nonebot | NoneBot is initializing...
10-09 15:38:17 [INFO] nonebot | Current Env: prod
10-09 15:38:17 [SUCCESS] nonebot | Succeeded to import "src.plugins.nonebot_plugin_apscheduler"
10-09 15:38:17 [SUCCESS] nonebot | Succeeded to import "src.plugins.nonebot_plugin_database_connector"
10-09 15:38:17 [SUCCESS] nonebot | Succeeded to import "src.plugins.nonebot_plugin_image_server"
10-09 15:38:17 [SUCCESS] nonebot | Succeeded to import "src.plugins.nonebot_plugin_mc_info"
10-09 15:38:18 [SUCCESS] nonebot | Succeeded to import "src.plugins.nonebot_plugin_mc_fun"
10-09 15:38:18 [SUCCESS] nonebot | Succeeded to import "src.plugins.nonebot_plugin_mc_cocdicer"
10-09 15:38:18 [SUCCESS] nonebot | Succeeded to import "src.plugins.nonebot_plugin_message_recorder"
10-09 15:38:18 [SUCCESS] nonebot | Succeeded to import "src.plugins.nonebot_plugin_permission"
10-09 15:38:18 [SUCCESS] nonebot | Succeeded to import "src.plugins.nonebot_plugin_help"
10-09 15:38:18 [SUCCESS] nonebot | Running NoneBot...
10-09 15:38:18 [INFO] uvicorn | Started server process [138578]
10-09 15:38:18 [INFO] uvicorn | Waiting for application startup.
10-09 15:38:18 [INFO] src | Scheduler Started
10-09 15:38:18 [INFO] src | Connect to Sqlite
10-09 15:38:18 [WARNING] src | 端口被占用,可能原因为图片存储服务器未正常退出,不再重复创建
10-09 15:38:18 [WARNING] src | Connect to Minecraft server: localhost:33333 failed! Please check config.
10-09 15:38:18 [WARNING] src | 服务器: localhost:33333连接被拒绝(可能原因:服务器未开启,插件端口配置错误), 将在10秒后重试...
10-09 15:38:18 [ERROR] uvicorn | Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/anyio/_core/_sockets.py", line 127, in try_connect
stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 1518, in connect_tcp
await get_running_loop().create_connection(StreamProtocol, host, port,
File "uvloop/loop.pyx", line 2024, in create_connection
File "uvloop/loop.pyx", line 2001, in uvloop.loop.Loop.create_connection
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/httpcore/_exceptions.py", line 8, in map_exceptions
yield
File "/usr/local/lib/python3.10/dist-packages/httpcore/backends/asyncio.py", line 101, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/usr/local/lib/python3.10/dist-packages/anyio/_core/_sockets.py", line 184, in connect_tcp
raise OSError('All connection attempts failed') from cause
OSError: All connection attempts failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
raise exc
File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
response = await connection.handle_async_request(request)
File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection.py", line 86, in handle_async_request
raise exc
File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection.py", line 63, in handle_async_request
stream = await self._connect(request)
File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection.py", line 111, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
File "/usr/local/lib/python3.10/dist-packages/httpcore/backends/auto.py", line 23, in connect_tcp
return await self._backend.connect_tcp(
File "/usr/local/lib/python3.10/dist-packages/httpcore/backends/asyncio.py", line 99, in connect_tcp
with map_exceptions(exc_map):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/dist-packages/httpcore/_exceptions.py", line 12, in map_exceptions
raise to_exc(exc)
httpcore.ConnectError: All connection attempts failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 621, in lifespan
async with self.lifespan_context(app):
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 518, in __aenter__
await self._router.startup()
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 598, in startup
await handler()
File "/root/bot/CirnoBot-master/./src/plugins/nonebot_plugin_mc_fun/__init__.py", line 26, in init
await check_server()
File "/root/bot/CirnoBot-master/./src/plugins/nonebot_plugin_mc_fun/util.py", line 96, in check_server
server_plugins = await server.get_plugins()
File "/root/bot/CirnoBot-master/./src/plugins/nonebot_plugin_mc_info/connect.py", line 385, in get_plugins
response = await client.get(f"http://{self.server_uri}/v1/plugins", headers={"key": self.auth_key})
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1729, in get
return await self.request(
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1506, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1593, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1621, in _send_handling_auth
response = await self._send_handling_redirects(
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1658, in _send_handling_redirects
response = await self._send_single_request(request)
File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1695, in _send_single_request
response = await transport.handle_async_request(request)
File "/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py", line 352, in handle_async_request
with map_httpcore_exceptions():
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed
10-09 15:38:18 [ERROR] uvicorn | Application startup failed. Exiting.
10-09 15:38:28 [WARNING] src | 服务器: localhost:33333连接被拒绝(可能原因:服务器未开启,插件端口配置错误), 将在10秒后重试...
10-09 15:38:38 [WARNING] src | 服务器: localhost:33333连接被拒绝(可能原因:服务器未开启,插件端口配置错误), 将在10秒后重试...
servertap插件配置没有修改,还是原样
lsof -i:33333查询端口占用的话没有任何服务在线,但是服务器内plugins查询servertap插件已经被加载了,这里是插件的问题吗?服务器版本是1.12.2mohist端,插件是从bot文档内的链接下载的,这里有什么办法可以解决吗求助大佬
mc服务器加载时是怎么输出的
尝试在服务器内访问一下http://localhost:33333/v1/ping,看看是否能正常访问
http://127.0.0.1:33333/v1/ping 目前访问不到这个地址
服务器使用的是java8 这里是服务器启动时servertap的日志
[16:07:41] [Server thread/INFO] [Mohist]: Enabling ServerTap v0.2.0
[16:07:41] [Server thread/WARN] [Mohist]: [ServerTap] TLS is not enabled.
[16:07:41] [Server thread/INFO] [Mohist]: [ServerTap] Enabling CORS for *
[16:07:41] [Server thread/ERROR] [Mohist]: Error occurred while enabling ServerTap v0.2.0 (Is it up to date?)
java.lang.NoSuchMethodError: kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
at io.javalin.plugin.openapi.OpenApiOptions.<clinit>(OpenApiOptions.kt:44) ~[ServerTap-0.2.0.jar:?]
at io.servertap.PluginEntrypoint.getOpenApiOptions(PluginEntrypoint.java:272) ~[ServerTap-0.2.0.jar:?]
at io.servertap.PluginEntrypoint.lambda$onEnable$2(PluginEntrypoint.java:168) ~[ServerTap-0.2.0.jar:?]
at io.javalin.core.JavalinConfig.applyUserConfig(JavalinConfig.java:204) ~[ServerTap-0.2.0.jar:?]
at io.javalin.Javalin.create(Javalin.java:92) ~[ServerTap-0.2.0.jar:?]
at io.servertap.PluginEntrypoint.onEnable(PluginEntrypoint.java:95) ~[ServerTap-0.2.0.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:177) ~[JavaPlugin.class:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:318) [JavaPluginLoader.class:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:399) [SimplePluginManager.class:?]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:477) [CraftServer.class:?]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:418) [CraftServer.class:?]
at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:340) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:315) [nz.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_342]
应该是servertap对魔改端的兼容性有问题,可以试试servertap的其他版本
好的感谢大佬解答
发生情况:机器人和mc是在同一个服务器上面,mc服务器配置插件正常运行,但是bot启动后无法连接端口,报错后被关闭 以下是bot输出日志:
bot配置文件:
mc服务器servertap插件配置:
mc服务器端是mohist端,求助我需要怎么做才能连接