一、解決flowable6.4 整合報
Caused by: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.${blobType}
啥情況,怎麼突然報這個錯?
先看看源碼。flowable6.4 中有一個xml 是這樣的
這裡就有一個jdbcType 是動态傳遞進去的,如何解決這個問題呢?
mybatis-spring-boot-starter 這個jar 包版本必須高于1.1.1 部落客之前用的1.1.1 無法傳遞參數,更新為1.3.1并在yml配置檔案中加入如下配置:
jar 資源
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
yml 配置
configuration-properties:
prefix:
blobType: BLOB
boolValue: TRUE
搞定!
二、解決flowable6.4報
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.flowable.ui.modeler.domain.Model.selectModelByParameters
啥情況,又出來這個錯!真是坑多!
先看看源碼
看了源碼很快就能發現問題,其實不看源碼隻能知道出錯的原因是因為掃描不到 DAO 對應的 xml 配置檔案,那為什麼會掃描不到呢?原因在于,首先我們需要看看自己的項目裡面存放mapper 配置檔案的路徑,部落客如下:
我這個mapper 下肯定沒有那個方法的配置檔案,怎麼辦呢?其實看了包的路徑你會發現,三個配置檔案是在 META-INF/modeler-mybatis-mappings 下面 的,是以解決方案為:在mybatis的mapper-locations 多增加一個路徑,記住英文逗号分隔
搞定!
三、flowable6.4 報 No message available
好不容易解決了上面兩個坑,終于可以看到界面,激動之下,去新增一個模型試試
當你輸入完之後你會發現,報錯了,提示 No message available
這個問題終端會輸出空指針,主要原因是什麼呢?檢視源碼發現
org.flowable.ui.modeler.service.ModelServiceImpl
分析源碼會發現其實是使用者的id 取不到,引發的空指針,進一步推斷,鑒權沒有破解,或者說,免登陸出了問題,或者是系統本身對擷取使用者的方法進行了權限控制。怎麼解決呢?首先我們需要找到擷取使用者的路徑位址。找到如下圖檔位址。
部落客這裡自行改過了,根據實際情況定。然後根據位址背景新增一個方法
import org.flowable.idm.api.User;
import org.flowable.idm.engine.impl.persistence.entity.UserEntityImpl;
import org.flowable.ui.common.model.UserRepresentation;
import org.flowable.ui.common.security.DefaultPrivileges;
import org.flowable.ui.common.security.SecurityUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* @author chenfeilong
* @ClassNme AdminRemoteAccountResource
* @Description 實作内置admin使用者免登陸
* @Date 2020/04/0500:02
* @version1.0
*/
@RestController
@RequestMapping("/apps")
public class AdminRemoteAccountResource {
/**
* GET /rest/account -> get the current user.
*/
@RequestMapping(value = "/rest/account", method = RequestMethod.GET, produces = "application/json")
public UserRepresentation getAccount() {
User user=new UserEntityImpl();
user.setId("admin");
SecurityUtils.assumeUser(user);
UserRepresentation userRepresentation = new UserRepresentation();
userRepresentation.setId("admin");
userRepresentation.setFirstName("admin");
List<String> privileges=new ArrayList<>();
List<String> pris = new ArrayList<>();
pris.add(DefaultPrivileges.ACCESS_MODELER);
pris.add(DefaultPrivileges.ACCESS_IDM);
pris.add(DefaultPrivileges.ACCESS_ADMIN);
pris.add(DefaultPrivileges.ACCESS_TASK);
pris.add(DefaultPrivileges.ACCESS_REST_API);
userRepresentation.setPrivileges(privileges);
return userRepresentation;
}
}
搞定!
如有疑問請聯系部落客:微信:xljx_888888 QQ:275300091