Unsupported Class Version Error in latest Square Java API (2023-07-20)

I’m working on a Java agent in my HCL Domino-hosted webapp, using the latest Square API (2023-07-20) and running into a problem when trying to establish the SquareClient connection. I realize that mine is very much not a standard execution environment, and one of the usual problems I have is ensuring I’m pulling in all the correct dependencies and attaching them as JARs. Because I’m using HCL Domino Designer’s (very early version) Eclipse-based IDE I have a heck of a time figuring out what are the versions of every dependency that the Square API relies on.

At the moment I’m pretty sure that one or more of my dependencies are out of whack, because I’m getting the following error:

[23F4:08C2-1340] 07/28/2023 03:15:50 PM HTTP JVM: ABOUT TO CONNECT TO THE SANDBOX SQUARE ENVIRONMENT
[23F4:08C3-1340] 07/28/2023 03:15:50 PM HTTP JVM: Exception in thread “AgentThread: JavaAgent”
[23F4:08C4-1340] 07/28/2023 03:15:50 PM HTTP JVM: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=, offset=6
[23F4:08C6-1340] 07/28/2023 03:15:50 PM HTTP JVM: at java.lang.ClassLoader.defineClassImpl(Native Method)
[23F4:08C8-1340] 07/28/2023 03:15:50 PM HTTP JVM: at java.lang.ClassLoader.defineClassInternal(ClassLoader.java:397)
[23F4:08CA-1340] 07/28/2023 03:15:50 PM HTTP JVM: at java.lang.ClassLoader.defineClass(ClassLoader.java:358)
[23F4:08CC-1340] 07/28/2023 03:15:50 PM HTTP JVM: at java.lang.ClassLoader.defineClass(ClassLoader.java:313)
[23F4:08CE-1340] 07/28/2023 03:15:50 PM HTTP JVM: at lotus.domino.AgentLoader.loadClass(Unknown Source)
[23F4:08D0-1340] 07/28/2023 03:15:50 PM HTTP JVM: at java.lang.ClassLoader.loadClass(ClassLoader.java:882)
[23F4:08D2-1340] 07/28/2023 03:15:50 PM HTTP JVM: at io.apimatic.core.GlobalConfiguration.(GlobalConfiguration.java:93)
[23F4:08D4-1340] 07/28/2023 03:15:50 PM HTTP JVM: at io.apimatic.core.GlobalConfiguration.(GlobalConfiguration.java:77)
[23F4:08D6-1340] 07/28/2023 03:15:50 PM HTTP JVM: at io.apimatic.core.GlobalConfiguration$Builder.build(GlobalConfiguration.java:301)
[23F4:08D8-1340] 07/28/2023 03:15:50 PM HTTP JVM: at com.squareup.square.SquareClient.(SquareClient.java:245)
[23F4:08DA-1340] 07/28/2023 03:15:50 PM HTTP JVM: at com.squareup.square.SquareClient.(SquareClient.java:207)
[23F4:08DC-1340] 07/28/2023 03:15:50 PM HTTP JVM: at com.squareup.square.SquareClient$Builder.build(SquareClient.java:941)
[23F4:08DE-1340] 07/28/2023 03:15:50 PM HTTP JVM: at JavaAgent.NotesMain(Unknown Source)
[23F4:08E0-1340] 07/28/2023 03:15:50 PM HTTP JVM: at lotus.domino.AgentBase.runNotes(Unknown Source)
[23F4:08E2-1340] 07/28/2023 03:15:50 PM HTTP JVM: at lotus.domino.NotesThread.run(Unknown Source)

I’ve already downloaded the latest Square Java SDK, but I cannot seem to figure out from that codebase what is the complete list of dependencies and their specific versions. Is this available anywhere in the documentation? (& to clarify I am very much a noob in the world of Java development so I don’t know what I don’t know.)

Any insight or pointers would be greatly appreciated, thanks in advance.

Hey @Justin_Goltermann! What documentation are you currently referencing?

The Quickstart would be the best way to get an example up and running, which you can then reference when setting up your actual project.

These Setup docs elaborate more specifically on dependency management with the Java SDK.

Josh, confirmed: I followed the instructions to get the Java SDK up and running in Eclipse,
and in doing that I was able to use Maven to pull in the dependencies and get them built
as JARs. Once I did this it was a relatively simple matter to carefully import all these JARs
into my Java agent in HCL Domino Designer, compile my code, save it, test and confirm
that everything works great.

Thanks for your assistance, please consider this matter resolved.

1 Like