[Java Agent] - apm-server replies with http400 - Problem validating JSON document

This is fixed in master, which contains a complete overhaul of the JSON serialization.

The problem is that the Java agent pre-allocates the Transaction.context.request object. But if this object is not null, the JSON schema requires the method to be set. In the current version on master, Transaction.context.request is only serialized if it actually hasContent.

Are you ok with building the Java agent from source?

FYI: when you enable TRACE logs for co.elastic.apm, you can see the actual JSON sent to the APM-server.