启动相关
lein ring server启动失败
- 【问题】lein run能正常启动,lein ring server启动报错
Syntax error (AssertionError) compiling at (/private/var/folders/0x/b3mhp5j52xg75qyb5h4xcph00000gn/T/form-init659192222195232290.clj:1:124). Assert failed: self-referential dependency (not (= x dep))
解决方案
- 代码中存在命名空间依赖循环导致,但clojure不会提醒你哪里循环了,需要自己去排查,我查出来是在
metabase.api.table
中再次 require 了 [metabase.api.table]
- 代码中存在命名空间依赖循环导致,但clojure不会提醒你哪里循环了,需要自己去排查,我查出来是在
lein ring server加载driver失败
- 【问题】lein run 一切正常,但使用lein ring server时,启动正常,用户配置等不查询数据的接口也调用正常,但只要查询数据图表就报错,无法查看数据
[{:type java.lang.IllegalArgumentException, :message "No implementation of method: :write-body-to-stream of protocol: #'ring.core.protocols/StreamableResponseBody found for class: metabase.async.streaming_response.StreamingResponse", :at [clojure.core$_cache_protocol_fn invokeStatic "core_deftype.clj" 583]}]
- 解决中
翻译组件加载失败
- 【问题】lein run/lein ring server 均能正常启动和使用,但只要更改语言就会报错,只能使用英文,其它语言都用不了
ERROR i18n.impl :: Error translating to zh: no resource bundle
解决方案
- 出错原因是因为程序在加载翻译文件时发现文件不存在,所以报错;
- 手动运行
bin/i18n/build-traslation-frontend-resource
,重新生成一次翻译文件即可; - 如果运行过程中报错gfmt: command not found,需要安装 gettext
MAC通过 brew install gettext 安装,Linux通过 apt-get install gettext 安装
接口调用相关
postman接口调不通
- 【问题】postman能调用接口,但显示权限不足
解决方案:
- 最粗暴的方法是到代码中将 +auth 和 (check-self-or-superuser id) 语句注释掉
- 更好的方案是修改postman中的header
1.增加 Cookie 并复制最新Cookie(后端通过cookie解析用户并验证权限)
2.修改 Accept 和 Content-Type 为 application/json