按照网上的七拼八凑整合网页版的部署将遇到的问题归置如下:
本人的springboot版本是:1.5.13.RELEASE
工作流相关:
org.activiti
activiti-spring-boot-starter-basic
${activiti.version}
org.activiti
activiti-diagram-rest
${activiti.version}
org.activiti
activiti-modeler
${activiti.version}
1、启动之后访问跳出输入用户名,密码,原因:activiti集成的安全校验
解决:在启动类加入:
@EnableAutoConfiguration(exclude = { org.activiti.spring.boot.SecurityAutoConfiguration.class,
org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class })
2、在线编辑器modeler.html访问的时候是空白,大部分是因为这个页面所需要的元素没有取到,检查相关的路径,
editor-app/app-cfg.js这个文件修改如下(都是按照实际项目配置来的,这个service可以按照自己实际的来,后面的三个类保持一致即可)
ACTIVITI.CONFIG = {
//'contextRoot' : '/activiti-explorer/service',
'contextRoot' : '/service'
};
查看是否改成系统一致的路径,
迁移过来的三个类:StencilsetRestResource.java
、ModelEditorJsonRestResource.java
、ModelSaveRestResource.java
统一在类上加@RequestMapping(value = "/service")
修改StencilsetRestResource.java
(如果在拷贝stencilset.json
时没有放在resources目录下)
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");把它改为相应的位置,
3、modeler.html?modelId=xxx里面的符号出现了方框(svg矢量图形都变成了不可辨识的字符),原因就是都配置了pom的资源路径下,pom会扫面资源路径,把变量替换成相应的值,二进制的文件就会收到破坏,把先关文件不扫描即可,如下配置
maven-resources-plugin
copy-xmls
process-sources
copy-resources
target/classes
src/main/resources
true
static/fonts/**
static/plugins/processes/editor-app/**
src/main/resources
false
static/fonts/**
static/plugins/processes/editor-app/**
4、model.html保存页面报错(400错误Required request body is missing),修改ModelSaveRestResource方法的参数,可以整个替换掉这个方法即可
@RequestMapping(value = "/model/{modelId}/save", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.OK)
public void saveModel(@PathVariable String modelId, String name, String description, String json_xml,
String svg_xml) {
try {
Model model = repositoryService.getModel(modelId);
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
modelJson.put(MODEL_NAME, name);
modelJson.put(MODEL_DESCRIPTION, description);
model.setMetaInfo(modelJson.toString());
model.setName(name);
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), json_xml.getBytes("utf-8"));
InputStream svgStream = new ByteArrayInputStream(svg_xml.getBytes("utf-8"));
TranscoderInput input = new TranscoderInput(svgStream);
PNGTranscoder transcoder = new PNGTranscoder();
// Setup output
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(outStream);
// Do the transformation
transcoder.transcode(input, output);
final byte[] result = outStream.toByteArray();
repositoryService.addModelEditorSourceExtra(model.getId(), result);
outStream.close();
} catch (Exception e) {
LOGGER.error("Error saving model", e);
throw new ActivitiException("Error saving model", e);
}
}
待续