把flowable弄到⾃⼰项⽬中,遇到的各种坑总结。⼀、下载官⽅提供war包
  1、在⼯程下建flowable包,将内容复制到下⾯
  复制flowable-modeler\WEB-INF\classes\static到⾃⼰项⽬中
  2修改js引⽤路径 app-cfg.js
FLOWABLE.CONFIG = {
'onPremise' : true,
'contextRoot' : "",
'webContextRoot' : "/static/flowable",
'datesLocalization' : false
};
  3、引⼊springboot官⽅jar包
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-rest</artifactId>
<version>${flowable.version}</version>
<exclusions>
<exclusion>
<artifactId>guava</artifactId>
<groupId&le.guava</groupId>
</exclusion>
</exclusions>
</dependency>
  4、添加⽤户认证,⽬前⽐较靠谱的代码如下:
@Controller
@RequestMapping("/app")
public class AccountUtil{
@RequestMapping("/rest/account")
@ResponseBody
public UserRepresentation getAccount() {
User user=new User() {
@Override
public String getId() {
return "admin";
}
@Override
public void setId(String s) {
}
@Override
public String getFirstName() {
return "admin";
}
@Override
public void setFirstName(String s) {
}
@Override
public void setLastName(String s) {
}
@Override
public String getLastName() {
return "admin";
}
@Override
public void setEmail(String s) {
}
@Override
public String getEmail() {
return "admin";
}
@Override
public String getPassword() {
return "admin";
}
web下载官方下载@Override
public void setPassword(String s) {
}
@Override
public boolean isPictureSet() {
return false;
}
};
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);
userRepresentation.setPrivileges(privileges);
return  userRepresentation;
}
}
⼆、填坑
  1、启动项⽬,看看抱什么错误,然后挨个修复
Caused by: java.lang.IllegalStateException: Required key 'idm.app.url' not found
at RequiredProperty(AbstractPropertyResolver.java:184)
at RequiredProperty(AbstractEnvironment.java:552)
at org.flowable.app.service.idm.RemoteIdmServiceImpl.init(RemoteIdmServiceImpl.java:67)
flect.NativeMethodAccessorImpl.invoke0(Native Method)
flect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
flect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at flect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:365)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:308)    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:135)
... 31 common frames omitted
    添加idm配置,不通版本可能对应key不⼀样,这个根据提⽰⾃⼰添加就⾏
idm.app.url=localhost:8080/
idm.admin.user=admin
idm.admin.password=test
  2、重启项⽬可以看到成功页⾯,其实还未成功,和后台数据还没连起来
  创建流程报错
  服务起返回: {"message":"Internal server error","exception":"nested exception is org.ptions.PersistenceException: \r\n### Error querying database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
org.flowable.app.domain.editor.Model.selectModelByParameters\r\n### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.flowable.app.domain.editor.Model.selectModelByParameters"}
  发现mybatis模板没有绑定:
  添加配置,多个可以⽤,隔开
mybatis-plus.mapper-locations=classpath*:META-INF/modeler-mybatis-mappings/*.xml
  3、再次重启后继续报错
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'URL
[jar:file:/D:/Dev/Repository/org/flowable/flowable-ui-modeler-logic/6.1.2/flowable-ui-modeler-logic-6.1.2.jar!/META-INF/l]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.pe.JdbcType.${blobType}
at org.apache.figurationElement(XMLMapperBuilder.java:120)
at org.apache.l.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
at sion.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:628) ... 111 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.pe.JdbcType.${blobType}
at org.apache.ibatis.solveJdbcType(BaseBuilder.java:73)
at org.apache.l.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:382)
at org.apache.sultMapElement(XMLMapperBuilder.java:280)
at org.apache.sultMapElement(XMLMapperBuilder.java:252)
at org.apache.sultMapElements(XMLMapperBuilder.java:244)
at org.apache.figurationElement(XMLMapperBuilder.java:116)
... 113 common frames omitted
Caused by: java.lang.IllegalArgumentException: No enum constant org.pe.JdbcType.${blobType}
at java.lang.Enum.valueOf(Enum.java:238)
at org.pe.JdbcType.valueOf(JdbcType.java:25)
at org.apache.ibatis.solveJdbcType(BaseBuilder.java:71)
... 118 common frames omitted
  到l,发下如下代码
<result property="tenantId" column="tenant_id" jdbcType="VARCHAR" />
  添加如下配置
  如果遇到缺少个别参数,可以在js中通过搜索地址,然后再请求中添加内容   
重启终于好了
  其实还未好,修改模板会出现不⽀持请求格式,可以重写questMappingHandlerAdapter⽅法  @Override
public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
RequestMappingHandlerAdapter adapter = new RequestMappingHandlerAdapter();
List<HttpMessageConverter<?>> converters = MessageConverters();
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
List<MediaType> supportedMediaTypes = new ArrayList<>();
MediaType textMedia = new MediaType(MediaType.TEXT_PLAIN, Charset.forName("UTF-8"));
supportedMediaTypes.add(textMedia);
MediaType jsonMedia = new MediaType(MediaType.APPLICATION_JSON, Charset.forName("UTF-8"));
supportedMediaTypes.add(jsonMedia);
MediaType urlencodeMedia = new MediaType(MediaType.APPLICATION_FORM_URLENCODED, Ch
arset.forName("UTF-8"));
supportedMediaTypes.add(urlencodeMedia);
jsonConverter.setSupportedMediaTypes(supportedMediaTypes);
converters.add(jsonConverter);
adapter.setMessageConverters(converters);
return adapter;
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。