zoukankan      html  css  js  c++  java
  • activiti5.22 中文乱码,离开开发模式后,单机部署explorer的war包时乱码的解决

    项目用springboot,在上线后,需要部署流程图和xml文件,从新部署了一个war官方的explorer的包,以用来生成流程图和xml

    需要改三个地方

    1.在电脑的系统变量里,添加JAVA_TOOL_OPTIONS,

    值为:-Dfile.encoding=UTF-8

    这一步可以在xml文件里,不在出现乱码,

    但是在保存的图片中,仍有乱码,需要改字体配置,见第四步

    第二:

    将activiti-explorer.war 文件改名为zip文件,修改里面的activiti-explorerWEB-INFclassesdb.properties 文件

    #db=h2
    #jdbc.driver=org.h2.Driver
    #jdbc.url=jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000
    #jdbc.username=sa
    #jdbc.password=

    db=mysql
    jdbc.driver=com.mysql.cj.jdbc.Driver
    jdbc.url=jdbc:mysql://localhost:3306/activiti_demo?useUnicode=true&characterEncoding=UTF-8
    jdbc.username=root
    jdbc.password=xxxxxx

    第三:

    在类lib中,添加mysql的驱动

    mysql-connector-java-8.0.23.jar 文件。

    第四:

    修改activiti-explorerWEB-INFclassesactiviti-custom-context.xml 文件

    将全部的注释去掉(若不去掉注释,否则将会出现连接h2数据库错误),然后在配置bean中加入,

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">

    <property name="activityFontName" value="宋体"></property>
    <property name="labelFontName" value="宋体"></property>


    </bean>

    完整文件如下,字体可以选择本机上有的中文字体

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
    
        
    
       <bean id="dbProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="classpath:db.properties" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
      </bean>
        
      <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="${jdbc.driver}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
        <property name="defaultAutoCommit" value="false" />
      </bean>
    
      <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
          <property name="dataSource" ref="dataSource" />
      </bean>
      
      <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
          <property name="dataSource" ref="dataSource" />
          <property name="transactionManager" ref="transactionManager" />
          <property name="databaseSchemaUpdate" value="true" />
          <property name="jobExecutorActivate" value="true" />
        <property name="enableDatabaseEventLogging" value="true" />
    <!--加入两个字体显示,否则图片为乱码-->    
    <property name="activityFontName" value="宋体"></property>
        <property name="labelFontName" value="宋体"></property>
    
        <property name="customFormTypes">
          <list>
            <bean class="org.activiti.explorer.form.UserFormType"/>
            <bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/> 
            <bean class="org.activiti.explorer.form.MonthFormType"/>   
          </list>
        </property>
      </bean>
      
      <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean" destroy-method="destroy">
          <property name="processEngineConfiguration" ref="processEngineConfiguration" />
      </bean>
      
      <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
      <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
      <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
      <bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
      <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
      <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
      <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />  
      
    </beans>
  • 相关阅读:
    RF操作execl
    fiddler 设置代理以后不能访问网络的解决办法
    Eclipse没有Web插件和JavaEE插件咋整
    mysql 分页查询的标准写法
    java读写操作
    java 链接mysql
    关于博客
    响应式排版中的基础知识
    前端性能优化最佳实践
    HTTP必知必会
  • 原文地址:https://www.cnblogs.com/sdgtxuyong/p/14662907.html
Copyright © 2011-2022 走看看