Closed Ian-zy1 closed 3 months ago
日志里面有具体的失败原因的,看下或者贴出来。还有把issue的信息补全下,不然不好排查
exception=ContentTypeError(RequestInfo(url=URL('http://10.3.240.112:20052/toLogin'), method='GET', headers=<CIMultiDictProxy('Host': '10.3.240.112:20052', 'XXL-JOB-ACCESS-TOKEN': 'xxl_job', 'Accept': '/', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Python/3.12 aiohttp/3.10.3')>, real_url=URL('http://10.3.240.112:20052/toLogin')), (<ClientResponse(http://10.3.240.112:20052/xxl-job-admin/api/callback) [302 None]> <CIMultiDictProxy('Location': '/toLogin', 'Content-Length': '0', 'Date': 'Mon, 19 Aug 2024 01:46:10 GMT')> ,), message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', headers=<CIMultiDictProxy('Content-Type': 'text/html;charset=UTF-8', 'Content-Language': 'en-US', 'Transfer-Encoding': 'chunked', 'Date': 'Mon, 19 Aug 2024 01:46:10 GMT')>)> Traceback (most recent call last): File "/dev/venv/my_venv/lib/python3.12/site-packages/pyxxl/executor.py", line 228, in _run await self.xxl_client.callback(data.logId, start_time, code=200, msg=result) File "/dev/venv/my_venv/lib/python3.12/site-packages/pyxxl/xxl_client.py", line 83, in callback await self._post("callback", payload) File "/dev/venv/my_venv/lib/python3.12/site-packages/pyxxl/xxl_client.py", line 94, in _post r = Response(**(await response.json())) ^^^^^^^^^^^^^^^^^^^^^ File "/dev/venv/my_venv/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1199, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url='http://10.3.240.112:20052/toLogin'
pyxxl访问http://10.3.240.112:20052/xxl-job-admin/api/callback
然后被服务端重定向到http://10.3.240.112:20052/toLogin'
了。服务端忘这个方向排查吧,看看为什么被重定向了
同蹲,解决方法
同蹲,解决方法
检查你所使用的xxl-job-admin的配置,查看是否配置了上下文路径;如果没有把ExecutorConfig配置中的xxl_admin_baseurl修改为xxl_admin_baseurl="http://localhost:10052/api/"。
感谢❀
Problem description
xxl-job调度任务成功,但回调时重定向到xxl登录。xxl_client.XXL.callback() 方法尝试从服务器获取JSON数据,但服务器返回了HTML内容(text/html;charset=utf-8),这与预期不符,导致了解析失败。
Steps to reproduce the problem
Specifications like the version of the project, operating system, or hardware