bsp

加密服务部署说明

1. 说明

本文用于指导部署 Java 加密服务(cryptographic-service-0.0.1-SNAPSHOT.jarservice-0.0.1-SNAPSHOT.jar),并在 Cache/IRIS 中完成调用配置。

2. 部署环境要求

2.1 Windows

2.2 Linux

3. 部署 JAR 服务

3.1 Windows 部署

  1. cryptographic-service-0.0.1-SNAPSHOT.jarservice-0.0.1-SNAPSHOT.jar放到 D:\ 根目录。

  2. 进入 JDK 的 bin 目录,清除文件路径信息后,输入cmd,运行java命令。

  3. 分别执行java启动命令:

     java -jar d:\cryptographic-service-0.0.1-SNAPSHOT.jar
     java -jar d:\service-0.0.1-SNAPSHOT.jar
    
  4. 启动成功后,出现 Started ServiceApplication in x.xxx seconds 表明已经启动成功。类似如下输出:

注意:直接在命令行启动时,关闭窗口后服务会终止。

3.2 Linux 部署

  1. 上传 cryptographic-service-0.0.1-SNAPSHOT.jarservice-0.0.1-SNAPSHOT.jar到:

     /dthealth/app/dthis/web/hisbase/bsp
    
    • 若目录不存在请先创建。
    • 若存在且有这两个jar包,则覆盖更新。
  2. 确认已安装 JDK 1.8(可使用附件 jdk-8u271-linux-x64.tar)。

  3. JDK1.8安装成功后,在Linux 的shell执行如下代码:(前台启动,用于首次验证):

     java -jar /dthealth/app/dthis/web/hisbase/bsp/cryptographic-service-0.0.1-SNAPSHOT.jar
     java -jar /dthealth/app/dthis/web/hisbase/bsp/service-0.0.1-SNAPSHOT.jar
    
  4. 启动成功后,出现 Started ServiceApplication in x.xxx seconds 表明已经启动成功。类似如下输出:

    image-20260515095351434

  5. (可选)后台启动(建议接口验证通过后再做):

     nohup java -jar /dthealth/app/dthis/web/hisbase/bsp/cryptographic-service-0.0.1-SNAPSHOT.jar > /tmp/javalog.txt 2>&1 &
     nohup java -jar /dthealth/app/dthis/web/hisbase/bsp/service-0.0.1-SNAPSHOT.jar > /tmp/javalog.txt 2>&1 &
    

    可通过 /tmp/javalog.txt 确认服务启动状态。若系统重启,需重新启动服务。

  6. (可选)配置开机自启(建议接口验证通过后再做):

    • 将附件中的 myjavaapp 放到 /etc/init.d/
    • 依次执行:

        sudo chmod +x /etc/init.d/myjavaapp
        sudo chkconfig --add myjavaapp
        sudo service myjavaapp start
        sudo chkconfig myjavaapp on
      
    • 查看 /tmp/javalog.txt,确认启动成功:

    注意:服务发布成功后,请勿停止该进程,否则接口调用会失败。

4. Cache/IRIS 导入与配置

  1. 将附件中的加密工具类导入目标 Cache/IRIS 数据库,要部署哪个命名空间就导入哪个命名空间。

  2. 导入时选择:
    • 勾选所有文件
    • 勾选编译导入项目
    • 点击 OK
  3. 若系统中已存在同名类,可直接覆盖更新。

  4. 导入完成后,打开 Util.Impl.EncryptionUtils,修改服务地址参数:
Parameter NonStandardAlgUrl = "http://localhost:28086";
Parameter StandardAlgUrl = "http://localhost:28087";

localhost 改为 JAR 所在服务器 IP,例如:

Parameter NonStandardAlgUrl = "http://192.168.1.1:28086";
Parameter StandardAlgUrl = "http://192.168.1.1:28087";

image-20260515095754680

5. 验证方法

验证成功后在Terminal中执行以该方法用于部署程序:

w ##class(Util.EncryptionUtils).Deploy()

运行后提示该内容即可:

DHC-APP>w ##class(Util.EncryptionUtils).Deploy()

Compilation started on 05/21/2026 11:03:06 with qualifiers 'cuk'
Removed deployed classes from compile list
Class Util.EncodingUtils is up-to-date.
Class Util.Encryption.BigIntBytes is up-to-date.
Class Util.Encryption.DES is up-to-date.
Class Util.Encryption.MD5 is up-to-date.
Class Util.Encryption.Primitives is up-to-date.
Class Util.Encryption.RSA is up-to-date.
Class Util.Encryption.RSAPrimitives is up-to-date.
Class Util.Encryption.SM2 is up-to-date.
Class Util.Encryption.SM2Callout is up-to-date.
Class Util.Encryption.SM2EmbeddedPython is up-to-date.
Class Util.Encryption.SM2Shell is up-to-date.
Class Util.Encryption.SM3 is up-to-date.
Class Util.Encryption.SM4 is up-to-date.
Class Util.Encryption.TripleDES is up-to-date.
Class Util.EncryptionUtils is up-to-date.
Class Util.Impl.EncodingUtils is up-to-date.
Class Util.Impl.EncryptionUtils is up-to-date.
Compilation finished successfully in 0.154s.
1

6. 常见问题