TL;DR
The error message comes from a wrong combination of the jnlpUrl
and secret
parameters. E.g. jnlpUrl from build-node-01 and secret from an other build-node.
Check your script where you connect the agent (build-node) to your jenkins.
java -jar agent.jar -jnlpUrl http://your-jenkins.com/computer/your-build-node-ABC/jenkins-agent.jnlp -secret <secret for your build node DEF>
Make sure the jnlpUrl
and secret
are for the same agent.
Details
I encountered the same problem today, and in my case, it turned out to be a copy-and-paste error!
On all our build-nodes we have startup script with this line
java -jar agent.jar -jnlpUrl http://my-jenkins.com/computer/my-build-node-01/jenkins-agent.jnlp -secret <secret for my-build-node-01>
I copied this startup script to the new build-node and only replaced the secret
java -jar agent.jar -jnlpUrl http://my-jenkins.com/computer/my-build-node-01/jenkins-agent.jnlp -secret <secret for my-build-node-02>
The URL was from build-node-01 and the secret was from build-node-02!
WRONG java -jar agent.jar -jnlpUrl http://my-jenkins.com/computer/my-build-node-01/jenkins-agent.jnlp -secret <secret for my-build-node-02>
CORRECT java -jar agent.jar -jnlpUrl http://my-jenkins.com/computer/my-build-node-02/jenkins-agent.jnlp -secret <secret for my-build-node-02>
The error message
This was the whole error message if you mess up the jnlpUrl
and the secret
[Fatal Error] :1:1: Invalid byte 2 of 2-byte UTF-8 sequence.
Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Invalid byte 2 of 2-byte UTF-8 sequence.
at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:263)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:342)
at java.xml/javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:122)
at hudson.remoting.Launcher.loadDom(Launcher.java:604)
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:546)
at hudson.remoting.Launcher.run(Launcher.java:346)
at hudson.remoting.Launcher.main(Launcher.java:297)
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.
at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:702)
at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:373)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1913)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.arrangeCapacity(XMLEntityScanner.java:1779)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipString(XMLEntityScanner.java:1817)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:158)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:861)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:247)
... 6 more