问题
I am trying to execute jenkins cli command
java -jar /home/jenkins/jenkins-cli.jar -s http://jenkins.server.com/ version --username jenkins --password jenkins
Getting following error
Aug 05, 2015 6:01:02 AM hudson.remoting.SynchronousCommandTransport$ReaderThread run SEVERE: I/O error in channel Chunked connection to http://jenkins.server.com/cli java.io.StreamCorruptedException: invalid stream header: 0A0A0A0A at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:804) at java.io.ObjectInputStream.(ObjectInputStream.java:299) at hudson.remoting.ObjectInputStreamEx.(ObjectInputStreamEx.java:40) at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34) at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)
hudson.remoting.RequestAbortedException: java.io.StreamCorruptedException: invalid stream header: 0A0A0A0A at hudson.remoting.Request.abort(Request.java:296) at hudson.remoting.Channel.terminate(Channel.java:815) at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:69) at ......remote call to Chunked connection to http://jenkins.server.com/cli(Native Method) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1361) at hudson.remoting.Request.call(Request.java:171) at hudson.remoting.Channel.call(Channel.java:752) at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:179) at hudson.remoting.$Proxy1.waitForProperty(Unknown Source) at hudson.remoting.Channel.waitForRemoteProperty(Channel.java:1205) at hudson.cli.CLI.(CLI.java:147) at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72) at hudson.cli.CLI._main(CLI.java:479) at hudson.cli.CLI.main(CLI.java:390)
Caused by:
java.io.StreamCorruptedException: invalid stream header: 0A0A0A0A at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:804) at java.io.ObjectInputStream.(ObjectInputStream.java:299) at hudson.remoting.ObjectInputStreamEx.(ObjectInputStreamEx.java:40) at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34) at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)
回答1:
Go to Configure Global Security > TCP port for JNLP agents and chose Random save and run your command again
回答2:
It seems this is a similar problem as: https://issues.jenkins-ci.org/browse/JENKINS-23232
It suggests that you can add in your Jenkins system config:
JAVA_ARGS="-Dhudson.diyChunking=false"
(in /etc/sysconfig/jenkins for RHEL ; /etc/default/jenkins for Ubuntu/Debian)
You will need to do a restart of the Jenkins server
回答3:
The only thing that worked for me was:
sudo apt-get install openjdk-7-jre
来源:https://stackoverflow.com/questions/31824605/jenkins-cli-command-gives-error-java-io-streamcorruptedexception-invalid-stream