I'm not personally familiar with the spring-petclinic app. It could be that it's using an older version of the Java agent, which does not work with your version of the stack. The README for spring-petclinic says:
Other versions of the Elasticstack may work. Currently, only version 6.4.2 has been tested.
If that's still accurate, it implies an old version of the Java agent is being used, as the current version will not work with APM Server 6.4.2. In addition, APM Server 7.2.0 will not support those older (pre-GA) versions of the Java agent.
I don't know if that documentation is accurate though. I'd suggest opening new, more specific topic and perhaps someone else can chime in.