You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jar包以systemctl服务运行时无法正常使用Kinesis流,直接执行却正常

Jar包以systemctl服务运行时无法正常使用Kinesis流,直接执行却正常

我碰到了一个棘手的问题:直接用命令java -jar filename.jar运行我的Jar包时,它能正常读取并消费AWS Kinesis流;但把它配置成systemctl服务在同一个环境下运行时,每次启动后都会毫无报错地触发优雅停机。

下面是服务运行时的关键日志内容:

  • Tomcat started on port 8092 (http) with context path '/'
  • Started Bootstrap in 3.906 seconds (process running for 4.903)
  • Initial state: [StreamConfig(streamIdentifier=stream_name, initialPositionInStreamExtended=InitialPositionInStreamExtended(position=LATEST, timestamp=null), consumerArn=null)]
  • With failover time 10000 ms and epsilon 25 ms, LeaseCoordinator will renew leases every 3308 ms, takeleases every 20050 ms, process maximum of 2147483647 leases and steal 1 lease(s) at a time.
  • With failover time 10000 ms and epsilon 25 ms, LeaseCoordinator will renew leases every 3308 ms, takeleases every 20050 ms, process maximum of 2147483647 leases and steal 1 lease(s) at a time.
  • Initializing LeaseCoordinator attempt 1
  • Waiting up to 20 seconds for shutdown to complete.
  • Starting lease cleanup thread.
  • Number of pending leases to clean before the scan : 0
  • Starting LeaseCoordinator
  • Scheduling periodicShardSync
  • Initialization complete. Starting worker loop.
  • Worker shutdown requested.
  • Elected leaders: fd1ceed5-3f45-42a3-aef2-...
  • Worker 5d35a20a-35a1-46f4-8ae2-... has successfully stopped lease-tracking threads
  • Stopping the lease cleanup thread.
  • Shutting down leader decider on worker 5d35a20a-35a1-46f4-8ae2-...
  • Successfully stopped leader election on the worker
  • Shutting down periodic shard sync task scheduler on worker 5d35a20a-35a1-46f4-8ae2-...
  • All record processors have been shutdown successfully.
  • Starting worker's final shutdown.
  • Shutting down CWPublication thread.
  • CWPublication thread finished.
  • Worker loop is complete. Exiting from worker.
  • Completed, shutting down now.

我已经尝试过下面这些方案,但都没有解决问题:

  • 修改Jar包及相关文件的权限、所有者,让它和直接执行时的用户保持一致
  • 将故障转移时间调整到10分钟

备注:内容来源于stack exchange,提问作者Earl Cee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 09:00:30