Welcome to the forum and thanks for the question 
You are using the distributed-tracing APIs wrong. You found the right documentation, but misinterpreted the code - it uses lambdas that only implement the way of setting and getting the header, without knowing the header name and value. Those are the responsibility of the agent.
Try changing
span.injectTraceHeaders((name, value) ->
conn.setRequestProperty("Myspan", "100"));
to
span.injectTraceHeaders((name, value) ->
conn.addRequestProperty(name, value));
and
Transaction transaction =ElasticApm.startTransactionWithRemoteParent(key>
request.getHeader("Myspan"));
to
Transaction transaction = ElasticApm.startTransactionWithRemoteParent(key ->
request.getHeader(key));