playwright-java: [Question] StackOverflowError: com.google.gson.internal loop error

Hi, im testing the playwright-java maven plugin, the version 0.180.0, with JDK 1.8 and maven project in java 1.8. I have a loop error trying the example test PageScreenshot

This is the loop error:

Exception in thread "main" java.lang.StackOverflowError
	at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
	at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)

       // + 750 times loop code

	at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:358)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:158)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
	at com.google.gson.Gson.getAdapter(Gson.java:423)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
	at com.google.gson.Gson.getAdapter(Gson.java:423)
	// + 250 times loop code
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
	at com.google.gson.Gson.getAdapter(Gson.java:423)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)

How can I solve this? Thanks everyone for your help

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 28 (10 by maintainers)

Most upvoted comments

Solved! I had a similar problem with another library and here I explain the problem in detail. https://github.com/MrGraversen/rust-rcon/pull/2

The error in short, is that Gson from JDK 12 fails, even if you compile in a previous java. The solution is to go to the latest version of Gson image image

Edit: Reviewing I have seen that you have the latest version of playwright. Probably then, that you are trying to use an older version and not the latest one.

Edit 2: Ok, in the latest version you don’t define the gson version, project can try to use another version. In the new one, you do define it to the latest version.