EOS Low-Code Platform 8 EOS Low-Code Platform 8
产品简介
学习指南
更新说明
安装与集成
初见EOS
低代码开发手册
专业代码开发手册
专题场景实战
公共服务框架
应用运行治理
升级手册
常见问题
  • 微服务应用打包、部署、运行方案
  • 1.场景介绍
  • 2.操作步骤
  • 2.1 解压fatjar
  • 2.2 打包fatjar
  • 2.3 拷贝脚本
  • 2.4 修改原启停脚本
  • 2.5 启停应用
  • 2.6 FAQ
  • 2.6.1 afcenter、bps、gateway都能正常启动,governor启动报错

# 微服务应用打包、部署、运行方案

# 1.场景介绍

微服务应用以fatjar方式运行,本文以AFCenter应用为例,提供不依赖打包源码就可以部署运行的方案。 此方案只适用于运行linuxOS startup.sh、shutdown.sh,不适用于winOS cmd脚本。

# 2.操作步骤

# 2.1 解压fatjar

用解压工具或者命令jar -xvf com.primeton.gocom.afcenterall.boot-8.3.1-exec.jar 解压fatar

# 2.2 打包fatjar

修改代码替换jar后,用命令jar -cvf0M com.primeton.gocom.afcenterall.boot-8.3.1-exec.jar ./ 打包fatjar

# 2.3 拷贝脚本

以本地win开发环境为例,新建launch.sh文件,在E:\EOS83\server\afcenter路径下右键打开Git Bash, 执行命令vim com.primeton.gocom.afcenterall.boot-8.3.1-exec.jar,手动将打开内容拷贝至launch.sh文件中。 注意:拷贝内容不要有重复! 将launch.sh文件放至与startup.sh同路径下。如下图:

img-packageDeploy-03

🔗示例launch.sh下载

img-packageDeploy-01

img-packageDeploy-02

# 2.4 修改原启停脚本

# 2.4.1 修改启动脚本startup.sh

把原来的 $BOOT_JAR $action "$@" 替换为

export JARFILE="$BOOT_JAR"
echo -e "\e[32m[Exec ]\e[0m" "$(dirname "$0")/launch.sh" "$action" "${RUN_ARGS[@]}"
  "$(dirname "$0")/launch.sh" "$action" "${RUN_ARGS[@]}"

# 2.4.2 修改停止脚本shutdown.sh

🔗env.sh下载

修改env.sh中APP_NAME的值,与启动脚本startup.sh中的APP_NAME保持一致。 将env.sh文件放至与shutdown.sh同路径下。如下图: img-packageDeploy-05

img-packageDeploy-04

# 2.5 启停应用

启停应用时执行 ./startup.sh ./shutdown.sh 注意:不要用run命令,用run不生成pid

# 2.6 FAQ

# 2.6.1 afcenter、bps、gateway都能正常启动,governor启动报错

governor启动报错: Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource [com/primeton/eos/dap/governor/config/GovernorConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.validation.beanvalidation.LocalValidatorFactoryBean]: Factory method 'defaultValidator' threw exception; nested exception is javax.validation.ValidationException: HV000183: Unable to initialize 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead

解决方案: governor-master-8.3.1-exec/BOOT-INF/lib/tomcat-embed-el-9.0.83.jar与内置应用服务器pas里面的jar冲突了导致的, 删除掉governor-master-8.3.1-exec/BOOT-INF/lib/tomcat-embed-el-9.0.83.jar,重新打包后,启动正常。

← EOS8.2配置达梦数据源 在线用户真实登录IP获取配置 →