ClientApiException: org.xml.sax.SAXParseException; lineNumber: 135; columnNumber: 3; The element type "meta" must be terminated by the matching end-tag "</meta>".

132 views
Skip to first unread message

Антон Бархатов

unread,
Sep 20, 2023, 10:50:46 PM9/20/23
to ZAP User Group
Hi all!
I wrote a small class to interact with ZAP via the API and ran into a problem. When starting on a working PC, the following error always appears:
owasp zap org.zaproxy.clientapi.core.ClientApiException: org.xml.sax.SAXParseException; lineNumber: 135; columnNumber: 3; The element type "meta" must be terminated by the matching end-tag "</meta>".
Google did not return anything useful for this error(
Tested on the following versions:
zap.jar: ZAP_2.13.0_Crossplatform, ZAP_WEEKLY_D-2023-09-18, ZAP_2.10.0_Core, ZAP_2.10.0_Crossplatform, ZAP_2_13_0_windows, ZAP_WEEKLY_D-2023-09-11
ZAP API Client: 1.12.0, 1.11.0, 1.10.0, 1.9.0, 1.8.0
Java: Oracle OpenJDK 11.0.13, Oracle OpenJDK 17.0.1, BellSoft Liberica 20.0.2
The result is the same.
The API works great through the browser or Postman or curl.
I tried to launch ZAP both through shortcuts on the desktop and with the command java -jar zap-2.13.0.jar -silent -config api.addrs.addr.name=.* -config api.addrs.addr.regex=true -config api.disablekey=true
At the same time, on a home computer with exactly the same versions of zap.jar, ZAP API Client and Java, everything works fine. Please help solve the problem!

Source code and exception stacktrace:

import org.testng.annotations.Test;
import org.zaproxy.clientapi.core.ApiResponseList;
import org.zaproxy.clientapi.core.ClientApi; //zap-clientapi-1.12.0.jar

public class zapExp {
    //java -jar zap-2.13.0.jar -silent -config api.addrs.addr.name=.* -config api.addrs.addr.regex=true -config api.disablekey=true
    //ZAP 2.13.0
    private static final String ZAP_PROXY_ADDRESS = "localhost";
    private static final int ZAP_PROXY_PORT = 8080;
    private static final String ZAP_API_KEY = null;
    private static final String TARGET = "https://juice-shop.***;

    @Test(description = "ZAP scan. Target: " + TARGET)
    public void zapTest() {
        try {
            ClientApi api = new ClientApi(ZAP_PROXY_ADDRESS, ZAP_PROXY_PORT, ZAP_API_KEY);
            System.out.println("version: " + api.core.version());
            System.out.println("zapHomePath: " + api.core.zapHomePath());
            System.out.println("contextList: " + ((ApiResponseList) api.context.contextList()).getItems());
        } catch (Exception e) {
            System.out.println("Exception: " + e.getMessage());
            e.printStackTrace();
        }
    }
}


zap_exception_stacktrace.txt

thc...@gmail.com

unread,
Sep 21, 2023, 4:00:15 AM9/21/23
to zaprox...@googlegroups.com
Hi.

Based on the response having a meta tag I'd say that you have a website
running on localhost:8080 in that machine, not ZAP.

Best regards.

On 21/09/2023 03:50, Антон Бархатов wrote:
> Hi all!
> I wrote a small class to interact with ZAP via the API and ran into a
> problem. When starting on a working PC, the following error always appears:
> *owasp zap org.zaproxy.clientapi.core.ClientApiException:
> org.xml.sax.SAXParseException; lineNumber: 135; columnNumber: 3; The
> element type "meta" must be terminated by the matching end-tag "</meta>".*

Антон Бархатов

unread,
Sep 21, 2023, 4:50:21 AM9/21/23
to ZAP User Group
I'm sure that ZAP is located on port 8080. Through curl everything works as it should. Proof in the screenshot.

I decided to run ZAP on a different IP and port: -host 127.0.0.1 -port 8081 and it worked!
I don’t know why there was a problem with the default host and port, perhaps the corporate antivirus is interfering.
Thanks for the tip!

четверг, 21 сентября 2023 г. в 15:00:15 UTC+7, thc202:
photo_2023-09-21_15-25-19.jpg
photo_2023-09-21_15-25-27.jpg
Reply all
Reply to author
Forward
0 new messages