I\'m using testng maven and selenium to run my tests, currently I have the following testng.xml file
Looks like the problem is with the &listeners and &class
I came across this error recently and tried the solutions given above but still got the error. Setting JVM arguments is the solution for this problem anyways as shown in above answers but I added one more step and it fixed my issue.
I changed the arguments in TestNG Configuration as shown below (added step):
I also changed the arguments in LoginTests.testSuccessfullLogin. (This step would only be necessary if you have ran the program with the issue. Otherwise if you are running the program for first time, it will create this configuration with the same arguments as in TestNG configuration.)
I also noticed that if you haven't done the second step mentioned above, it will create a new configuration called LoginTests.testSuccessfullLogin(1) with the changed arguments in order to run the tests.