arthas无网络环境下离线安装方法
原文:https://www.jianshu.com/p/9abb11d5c5a1
本文主要介绍当服务器无法连接互联网情况下,无法安装arthas的解决方法。
一、下载
参考文末参考文章3中下载。也可以直接把下面文中的链接取出,直接用下载器下载。
# github下载
wget https://alibaba.github.io/arthas/arthas-boot.jar
# 或者 Gitee 下载
wget https://arthas.gitee.io/arthas-boot.jar
# 打印帮助信息
java -jar arthas-boot.jar -h
二、安装
# 运行方式1,先运行,在选择 Java 进程 PID
java -jar arthas-boot.jar
当联网安装时,可以正常安装。看下面的执行日志,可以看到,联网时会到maven.aliyun.com的私服库里去获取jar包。但是离线时,是无法直接获取的,执行时,会出现无法连接aliyun.com等error。
Downloads herman$ java -jar arthas-boot.jar
[INFO] arthas-boot version: 3.1.7
[INFO] Found existing java process, please choose one and hit RETURN.
* [1]: 59874 com.dtm.starter.StartApplication
[2]: 26057
[3]: 68065 com.bayss.infin.core.AppStarter
1
[INFO] Start download arthas from remote server: http://maven.aliyun.com/repository/public/com/taobao/arthas/arthas-packaging/3.1.7/arthas-packaging-3.1.7-bin.zip
[INFO] File size: 10.33 MB, downloaded size: 1.08 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 2.15 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 3.23 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 4.38 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 5.40 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 6.54 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 7.52 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 8.66 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 9.71 MB, downloading ...
[INFO] Download arthas success.
[INFO] arthas home: /Users/herman/.arthas/lib/3.1.7/arthas
[INFO] Try to attach process 59874
[WARN] Current VM java version: 1.7 do not match target VM java version: 1.8, attach may fail.
[WARN] Target VM JAVA_HOME is /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre, arthas-boot JAVA_HOME is /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre, try to set the same JAVA_HOME.