mac,jdk怎么样才算是配置成功,为什么我的jenkins节点启动失败--问题已解决。

jenkins中构建​job。发现使用的mac节点报错:

连接中断

java.nio.channels.ClosedChannelException at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer.onReadClosed(ChannelApplicationLayer.java:238) at org.jenkinsci.remoting.protocol.ApplicationLayer.onRecvClosed(ApplicationLayer.java:221) at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:825) at org.jenkinsci.remoting.protocol.FilterLayer.onRecvClosed(FilterLayer.java:288) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.onRecvClosed(SSLEngineFilterLayer.java:179) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.switchToNoSecure(SSLEngineFilterLayer.java:281) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.processWrite(SSLEngineFilterLayer.java:501) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.processQueuedWrites(SSLEngineFilterLayer.java:246) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.doSend(SSLEngineFilterLayer.java:198) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.doCloseSend(SSLEngineFilterLayer.java:211) at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doCloseSend(ProtocolStack.java:793) at org.jenkinsci.remoting.protocol.ApplicationLayer.doCloseWrite(ApplicationLayer.java:172) at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer$ByteBufferCommandTransport.closeWrite(ChannelApplicationLayer.java:340) at hudson.remoting.Channel.close(Channel.java:1500) at hudson.remoting.Channel.close(Channel.java:1453) at hudson.slaves.SlaveComputer.closeChannel(SlaveComputer.java:887) at hudson.slaves.SlaveComputer.access$100(SlaveComputer.java:108) at hudson.slaves.SlaveComputer$2.run(SlaveComputer.java:767) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

老师帮忙看了说是我电脑jdk有问题。于是我开始删除重新安装配置,操作如下:

1,从Mac设备中删除Java的方法。

sudo rm -rf“/ Library / Internet Plug-Ins / JavaAppletPlugin.plugin”
sudo rm -rf“/Library/PreferencePanes/JavaControlPanel.prefPane”
sudo rm -rf“〜/ Library / Application Support / Java”

2.删除当前版本的jdk

sudo rm -rf /Library/Java/JavaVirtualMachines/jdkxxxxx.jdk

(注:不确定版本号先查看当前版本 ls /Library/Java/JavaVirtualMachines/

3.检查是否卸载成功

java -version

(base) come-on:Downloads comeon$ java

-bash: /Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/bin/java: No such file or directory

(base) come-on:Downloads comeon$ java -version

-bash: /Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/bin/java: No such file or directory

(base) come-on:Downloads comeon$ java

-bash: /Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/bin/java: No such file or directory

(base) come-on:Downloads comeon$ source ~/.bash_profile

(base) come-on:Downloads comeon$ java

The operation couldn’t be completed. Unable to locate a Java Runtime.

Please visit http://www.java.com for information on installing Java.

(base) come-on:Downloads comeon$

4,安装jdk

访问https://www.java.com/下载安装java后,下面路径下发现没有内容。

$ cd /Library/Java/JavaVirtualMachines/

(base) localhost:JavaVirtualMachines comeon$ ls

(base) localhost:JavaVirtualMachines comeon$

mac 安装openjdk

a)更新本地的 brew库:

brew tap AdoptOpenJDK/openjdk

报错:

fatal: unable to access ‘https://github.com/AdoptOpenJDK/homebrew-openjdk/’: LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

解决方法1----未成功~:

查询无法获取的ip地址https://www.ipaddress.com/

然后将ip地址填入本机的host文件里

(不让直接修改。vi /etc/hosts这样修改保存会失败)

123.115.50.136 github.com

直接讲hosts文件打开修改后保存到其他文件夹,再拖回覆盖etc内的文件即可

brew tap AdoptOpenJDK/openjdk

执行后:

fatal: unable to access ‘https://github.com/AdoptOpenJDK/homebrew-openjdk/’: Failed to connect to github.com port 443: Operation timed out

Error: Failure while executing; git clone https://github.com/AdoptOpenJDK/homebrew-openjdk /usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk --origin=origin --template= exited with 128.

解决方法2–未成功解决问题:

cd "$(brew --repo)/Library/Taps/"
rm -rf homebrew
mkdir homebrew
cd homebrew
git clone git://mirrors.ustc.edu.cn/homebrew-core.git
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
————————————————
原文链接:https://blog.csdn.net/weixin_35757704/article/details/112134619

解决方法3–换网络

仍然报错

解决方法4–?

brew install curl

brew tap AdoptOpenJDK/openjdk

仍提示:

==> Tapping adoptopenjdk/openjdk

Cloning into ‘/usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk’…

fatal: unable to access ‘GitHub - AdoptOpenJDK/homebrew-openjdk: AdoptOpenJDK HomeBrew Tap’: Failed to connect to github.com port 443: Operation timed out

Error: Failure while executing; git clone https://github.com/AdoptOpenJDK/homebrew-openjdk /usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk --origin=origin --template= exited with 128.

brew tap AdoptOpenJDK/openjdk一直运行失败,干脆换其他方式来安装

 brew search openjdk

brew install openjdk@8
brew install openjdk@11

修改配置文件

JAVA_HOME=/usr/local/opt/openjdk@8
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPAT

此时,查看java版本

返回:

java version “1.8.0_301”

Java™ SE Runtime Environment (build 1.8.0_301-b09)

Java HotSpot™ 64-Bit Server VM (build 25.301-b09, mixed mode)

如上,我的jdk是安装好了吗?
我的jenkins里的节点启动目前仍然失败。 :hot_face:

又下载了jdk-8u301xxxx.dmg
和,jre-8u301-macosx-x64 (2).dmg
但是没有重新修改配置文件。
再次使用命令启动节点。成功了。

不错哦,把问题解决的思路和历程记录下来,下次碰到不迷路;你的现象的确很奇怪,定位问题上来讲就是出在了jdk环境上

关闭