按照网上的七拼八凑整合网页版的部署将遇到的问题归置如下:
本人的springboot版本是:1.5.13.RELEASE
工作流相关:
<!--工作流-->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
</dependency> <!-- Activiti 流程图 -->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-diagram-rest</artifactId>
<version>${activiti.version}</version>
</dependency>
<!-- Activiti 在线设计 -->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-modeler</artifactId>
<version>${activiti.version}</version>
</dependency>
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会扫面资源路径,把变量替换成相应的值,二进制的文件就会收到破坏,把先关文件不扫描即可,如下配置
<!--
此plugin可以用利用此plugin,把源代码中的xml文件,打包到相应位置,这里主要是为了打包Mybatis的mapper.xml文件,如下只
是截取了与 maven-resources-plugin 相关pom文件配置,其它部分按照自己的工程目录来。
-->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-xmls</id>
<phase>process-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/fonts/**</exclude>
<exclude>static/plugins/processes/editor-app/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/fonts/**</include>
<include>static/plugins/processes/editor-app/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
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);
}
}
待续