The codebase compiles just fine, I have set up my endpoint and I definitely receive Stripe events in it. The Json looks correct. This is the payload value seen in the debugger (triggered using stripe trigger payment_intent.succeeded):
But at runtime, the fromJson method doesn't even get called cause I get NoClassDefFoundError:
The local Stripe listener gets HTTP 500
is it possible I did not set the library up correctly? Note that the compiler finds the class just fine. Can I get some help with this?
To Reproduce
Set up a local endpoint in a java server
Start a local stripe listener
trigger events using stripe trigger payment_intent.succeeded
place a breakpoint on ApiResource.GSON.fromJson(payload, Event.class); and observe the behaviour
Expected behavior
ApiResource.GSON.fromJson(payload, Event.class); gets called and it parses the json into an Event class
Code snippets
This is my resource:
@Path("/stripe/events")
public class StripeEventsResource {
public StripeEventsResource() {}
@POST
@Timed
@ResponseMetered
public Response processRequest(byte[] in, @Context HttpServletRequest httpServletRequest) {
String payload = new String(in);
Event event = null;
try {
event = ApiResource.GSON.fromJson(payload, Event.class); // I don't get past this line
event = Webhook.constructEvent(
payload, httpServletRequest.getHeader("Stripe-Signature"), "whsec_662cc1572cea897f91bec3d1268a01b1f624ea417d6e3b17c62c063502528694"
);
return Response.status(Response.Status.OK).build();
} catch (Exception e) {
// I don't see any of these logs and the debugger does not get here
System.out.println("======== internal server error. message: " + e.getMessage());
System.out.println("======== internal server error. type: " + e.getClass());
System.out.println("======== internal server error. cause: " + e.getCause());
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
}
Describe the bug
I have added the stripe dependency in the pom file as described in the documentation
The codebase compiles just fine, I have set up my endpoint and I definitely receive Stripe events in it. The Json looks correct. This is the payload value seen in the debugger (triggered using
stripe trigger payment_intent.succeeded
):But at runtime, the
fromJson
method doesn't even get called cause I get NoClassDefFoundError:The local Stripe listener gets HTTP 500
is it possible I did not set the library up correctly? Note that the compiler finds the class just fine. Can I get some help with this?
To Reproduce
stripe trigger payment_intent.succeeded
ApiResource.GSON.fromJson(payload, Event.class);
and observe the behaviourExpected behavior
ApiResource.GSON.fromJson(payload, Event.class);
gets called and it parses the json into an Event classCode snippets
OS
macOS
Java version
Java 21
stripe-java version
27.0.0
API version
2024-09-30
Additional context
No response