austek / pact-avro-plugin

Pact AVRO Plugin
https://austek.github.io/pact-avro-plugin/
MIT License
8 stars 3 forks source link

`java.lang.UnsupportedClassVersionError` in consumer test #26

Closed mefellows closed 1 year ago

mefellows commented 1 year ago

Running this example results in a plugin failure: See also https://github.com/pact-foundation/pact-go/pull/291

The core issue seems to be:

pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) || Exception in thread "grpc-default-executor-0" java.lang.UnsupportedClassVersionError: au/com/dius/pact/core/model/matchingrules/expressions/MatchingRuleDefinition has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Wider log:

2023-07-11T23:49:10.3233015Z 2023-07-11T23:49:10.250451Z DEBUG   ffi-setup_contents Connection{peer=Client}: h2::codec::framed_read: received frame=Headers { stream_id: StreamId(1), flags: (0x5: END_HEADERS | END_STREAM) }
2023-07-11T23:49:10.3233983Z 2023-07-11T23:49:10.250558Z ERROR ThreadId(01) pact_plugin_driver::content: Call to plugin failed - status: Unknown, message: "", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc"} }
2023-07-11T23:49:10.3235480Z 2023-07-11T23:49:10.250811Z ERROR ThreadId(01) pact_ffi::plugins: Failed to call out to plugin - Call to plugin failed - status: Unknown, message: "", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc"} }
2023-07-11T23:49:10.3236293Z 2023-07-11T23:49:10.251025Z DEBUG ThreadId(01) pact_mock_server::mock_server: Started mock server on 127.0.0.1:45241
2023-07-11T23:49:10.3237838Z 2023-07-11T23:49:10.253915Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) || Exception in thread "grpc-default-executor-0" java.lang.UnsupportedClassVersionError: au/com/dius/pact/core/model/matchingrules/expressions/MatchingRuleDefinition has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
2023-07-11T23:49:10.3239302Z 2023-07-11T23:49:10.253929Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.lang.ClassLoader.defineClass1(Native Method)
2023-07-11T23:49:10.3240316Z 2023-07-11T23:49:10.253931Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
2023-07-11T23:49:10.3241393Z 2023-07-11T23:49:10.253933Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
2023-07-11T23:49:10.3242550Z 2023-07-11T23:49:10.253936Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
2023-07-11T23:49:10.3243819Z 2023-07-11T23:49:10.253938Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
2023-07-11T23:49:10.3245084Z 2023-07-11T23:49:10.253940Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
2023-07-11T23:49:10.3246267Z 2023-07-11T23:49:10.253941Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
2023-07-11T23:49:10.3247528Z 2023-07-11T23:49:10.253943Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
2023-07-11T23:49:10.3248565Z 2023-07-11T23:49:10.253945Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
2023-07-11T23:49:10.3249571Z 2023-07-11T23:49:10.253947Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.RuleParser$.parseRules(RuleParser.scala:20)
2023-07-11T23:49:10.3250576Z 2023-07-11T23:49:10.253949Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.RuleParser$.parseRules(RuleParser.scala:15)
2023-07-11T23:49:10.3251604Z 2023-07-11T23:49:10.253950Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroValue$.apply(AvroRecord.scala:77)
2023-07-11T23:49:10.3252650Z 2023-07-11T23:49:10.253952Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroRecord$.selectField(AvroRecord.scala:433)
2023-07-11T23:49:10.3253704Z 2023-07-11T23:49:10.253954Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroRecord$.$anonfun$apply$18(AvroRecord.scala:407)
2023-07-11T23:49:10.3254696Z 2023-07-11T23:49:10.253956Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.collection.immutable.List.map(List.scala:246)
2023-07-11T23:49:10.3396693Z 2023-07-11T23:49:10.253958Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.collection.immutable.List.map(List.scala:79)
2023-07-11T23:49:10.3397764Z 2023-07-11T23:49:10.253960Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroRecord$.apply(AvroRecord.scala:403)
2023-07-11T23:49:10.3398814Z 2023-07-11T23:49:10.253961Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.Avro$AvroRecord$.apply(AvroRecord.scala:399)
2023-07-11T23:49:10.3400247Z 2023-07-11T23:49:10.253963Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.interaction.InteractionBuilder$.buildResponse(InteractionBuilder.scala:48)
2023-07-11T23:49:10.3401546Z 2023-07-11T23:49:10.253967Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.interaction.InteractionBuilder$.build(InteractionBuilder.scala:34)
2023-07-11T23:49:10.3402885Z 2023-07-11T23:49:10.253969Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.interaction.InteractionResponseBuilder$.build(InteractionResponseBuilder.scala:17)
2023-07-11T23:49:10.3404241Z 2023-07-11T23:49:10.253971Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.PactAvroPluginService.$anonfun$configureInteraction$3(PactAvroPluginService.scala:56)
2023-07-11T23:49:10.3405321Z 2023-07-11T23:49:10.253973Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.util.Either.flatMap(Either.scala:352)
2023-07-11T23:49:10.3406467Z 2023-07-11T23:49:10.253974Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.PactAvroPluginService.$anonfun$configureInteraction$2(PactAvroPluginService.scala:55)
2023-07-11T23:49:10.3407692Z 2023-07-11T23:49:10.253976Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.util.Either.flatMap(Either.scala:352)
2023-07-11T23:49:10.3408835Z 2023-07-11T23:49:10.253978Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.PactAvroPluginService.$anonfun$configureInteraction$1(PactAvroPluginService.scala:54)
2023-07-11T23:49:10.3409898Z 2023-07-11T23:49:10.253980Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at scala.util.Either.flatMap(Either.scala:352)
2023-07-11T23:49:10.3411066Z 2023-07-11T23:49:10.253981Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at com.github.austek.plugin.avro.PactAvroPluginService.configureInteraction(PactAvroPluginService.scala:53)
2023-07-11T23:49:10.3412346Z 2023-07-11T23:49:10.253983Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.pact.plugin.pact_plugin.PactPluginGrpc$PactPlugin$.$anonfun$bindService$7(PactPluginGrpc.scala:188)
2023-07-11T23:49:10.3413518Z 2023-07-11T23:49:10.253985Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
2023-07-11T23:49:10.3414700Z 2023-07-11T23:49:10.253987Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:352)
2023-07-11T23:49:10.3415953Z 2023-07-11T23:49:10.253989Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
2023-07-11T23:49:10.3417084Z 2023-07-11T23:49:10.253991Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
2023-07-11T23:49:10.3418123Z 2023-07-11T23:49:10.253992Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
2023-07-11T23:49:10.3419494Z 2023-07-11T23:49:10.253994Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
2023-07-11T23:49:10.3420762Z 2023-07-11T23:49:10.253996Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
2023-07-11T23:49:10.3421750Z 2023-07-11T23:49:10.253998Z DEBUG tokio-runtime-worker pact_plugin_driver::child_process: Plugin(avro, 12167, STDERR) ||   at java.base/java.lang.Thread.run(Thread.java:829)
austek commented 1 year ago

Cause of this issue is that the plugin was compiled using JDK 17 as it is the required version for pact driver 4.6.0. java 17 is required to run the plugin

mefellows commented 1 year ago

Thanks Ali. So do we need to update the JVM Plugin Driver? Do I need to move this bug upstream?

austek commented 1 year ago

We need some clarifications to figure out. This plugin was compiled using matchers version 4.6.0 and core 0.4.0, what does that mean for the end users? what is the backward/forward compatibility of the driver? what version of the driver is OK to use for the endusers?

mefellows commented 1 year ago

Good questions, and I'm sorry to say ones I can't answer.

@uglyog I had a quick whip through the docs around this but couldn't see if this was addressed. Mind jumping in here?

rholshausen commented 1 year ago

Pact-JVM matchers version 4.6.x requires min JDK 17, 4.5.x has min JDK 11. The plugin driver core 0.4.0 requires min JDK 11.

So either document the minimum JDK as 17, or downgrade Pact-JVM matchers to 4.5.x to get support for JDK 11.

I think minimum JDK 17 is a fair ask.