sofa-ark icon indicating copy to clipboard operation
sofa-ark copied to clipboard

容器卸载biz提示成功,但biz的WEB接口仍然可访问

Open haozi2015 opened this issue 3 years ago • 5 comments

Describe the bug

容器卸载biz,提示成功,但WEB接口仍然可访问

Expected behavior

biz卸载后,相应的WEB接口应不存在

Actual behavior

依然可以访问

Steps to reproduce

  1. 容器添加WEB接口
 @GetMapping("/install")
    public Object install() throws Throwable {
        URL bizUrl1 = this.getClass().getClassLoader()
                .getResource("sample-ark-springboot2-1.0-SNAPSHOT-ark-biz.jar");
        File bizFile = ArkClient.createBizSaveFile("sample-ark-springboot2", "1.0.0");
        FileUtils.copyInputStreamToFile(bizUrl1.openStream(), bizFile);
        ClientResponse response = ArkClient.installBiz(bizFile);
        return response;

    }
    @GetMapping("/uninstall")
    public Object uninst() throws Throwable {
        ClientResponse response = ArkClient.uninstallBiz("sample-ark-springboot2", "1.0-SNAPSHOT");
        return response;
    }
  1. 复制粘贴/sample-ark-springboot,重命名sample-ark-springboot2,并添加WEB接口,修改biz端口成8081
  2. 构建mvn clean package,将sample-ark-springboot2相应的biz包,复制粘贴到容器的resources目录
  3. 再次构建mvn clean package
  4. 通过java -jar方式启动容器
  5. 通过http请求/install接口,加载biz
  6. 访问biz端口的web接口,正常
  7. 通过http请求/uninstall接口,卸载biz
  8. 再次访问biz端口的web接口,依然可访问,从telnet中查看已没有这个biz

Environment

  • SOFAArk version: 1.1.6
  • JVM version (e.g. java -version):
  • OS version (e.g. uname -a):
  • Maven version:
  • IDE version:

haozi2015 avatar Oct 15 '21 02:10 haozi2015

感谢反馈,@alaneuler @glmapper 帮忙看看哈

seeflood avatar Dec 07 '21 11:12 seeflood

@haozi2015 是否有报错信息?可以关注下 ArkTomcatWebServer

glmapper avatar Jan 04 '22 08:01 glmapper

@haozi2015 Hello,请问问题还有吗?

lylingzhen avatar Mar 28 '22 06:03 lylingzhen

问问 lz :安装的 Web Server 类型的 Biz,需要设置新的端口吗(因为我自己跑的时候不修改端口会跟宿主应用冲突)

AmarisEx avatar Jun 01 '22 08:06 AmarisEx

如果有不同版本biz包存在但未激活,web接口仍可以访问

wangxiaotao00 avatar Aug 26 '22 07:08 wangxiaotao00

这个问题怎么解决的

zhangqianz avatar Apr 04 '23 05:04 zhangqianz

@AmarisEx web server 类型的 Biz 应用嵌入到基座有两种模式:多 Host 与单 Host 模式。 多 Host 需要 Biz 应用设置新端口,单 Host 不需要设置新端口,而是需要 Biz 应用设置 webContextPath。具体可以看下这个文档:https://www.sofastack.tech/projects/sofa-boot/sofa-ark-spring-boot-demo/ @haozi2015 @wangxiaotao00 @zhangqianz 目前 Sofa boot 支持动态卸载,Spring boot 不支持动态卸载。如果 Spring boot 应用要动态卸载,需要注册一个卸载的事件handler,请参考 sofaboot 的代码:SofaBizUninstallEventHandler。同 #554

gaosaroma avatar Jul 03 '23 04:07 gaosaroma

问题过久,先关闭,有需要再 Reopen。

lylingzhen avatar Sep 07 '23 04:09 lylingzhen