Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.

created at 10-25-2021 views: 2

The project uses VMware vSphere to take a snapshot before the software upgrade.




java.rmi.RemoteException: VI SDK invoke exception:org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.


Based on my instinct, I believe that the other party upgraded the VM Server. (Don’t ask why not notify)
Then look for the current version and how to check the version

Starting with vSphere 4.0, information about the supported API versions is contained in an XML file, vimServiceVersions.xml, located on the server (see Service-Versions File (vimServiceVersions.xml)). You can access this file with the URL https://server_hostname/sdk/vimServiceVersions.xml.

Service-Versions File (vimServiceVersions.xml)
<?xml version="1.0" encoding="UTF-8" ?>
- <!--    Copyright 2008-2010 VMware, Inc.  All rights reserved. -->
- <namespaces version="1.0">
     - <namespace>
     - <priorVersions>
     - <namespace>

Check it,

Will the version of vijava used by the client be updated?
When I found the Maven repository, good guys, only this version is the version currently in use.

Could it be that this 7.x version is newly upgraded, causing vijava.jar to not support it?
The key word is determined as: vijava vsphere 7

Sure enough there is a problem

The official notice 

The HTTP reverse proxy in vSphere 7.0 enforces stricter standard compliance than previous versions. This may cause pre-existing issues in certain third-party libraries that applications use to make SOAP calls to vSphere.
If you develop vSphere applications that use such libraries, or include applications that rely on such libraries in the vSphere stack, you may encounter connection problems when these libraries send HTTP requests to VMOMI. For example, an HTTP request from the vijava library may take the following form:
POST /sdk HTTP/1.1
Content-Type: text/xml; charset=utf-8
User-Agent: Java/1.8.0_221
The syntax in this example violates the HTTP protocol header field requirement that a colon must be used after SOAPAction. Therefore, the request was rejected at the time of execution.
Solution: Developers who use non-compliant libraries in their applications can consider using libraries that follow the HTTP standard instead. For example, developers who use the vijava library can consider using the latest version of the yavijava library instead.


Replace vijava.jar with yavijava.jar.

Download jar

Install jar

mvn install:install-file -Dfile=PATH/yavijava-6.0.05.jar -DgroupId=com.toastcoders -DartifactId=yavijava -Dversion=6.0.05 -Dpackaging=jar

Reference jar

created at:10-25-2021
edited at: 10-25-2021: