This issue could possibly occur due to mismatch between dependency versions.
Please check to esure that you using a supported opentelemetry java agent version that agrees with the rest of the libraries as documented in the docs here: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md
You can confirm if this is the issue by running your application without the opentelemetry java agent and see if it then prints the trace/spanID correctly.