concursus icon indicating copy to clipboard operation
concursus copied to clipboard

Tuple Schema Mismatch

Open pgremo opened this issue 10 years ago • 3 comments

For example: The StateBuildingExample fails with: java.lang.IllegalArgumentException: key TupleKey<arg1> does not belong to schema person/created_0{arg2: java.lang.String,arg3: java.time.LocalDate} at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) at com.opencredo.concursus.data.tuples.Tuple.get(Tuple.java:42) at com.opencredo.concursus.mapping.events.methods.reflection.interpreting.EventMethodType.populateArgsFromTuple(EventMethodType.java:69) at com.opencredo.concursus.mapping.events.methods.reflection.interpreting.EventMethodType.apply(EventMethodType.java:59) at com.opencredo.concursus.mapping.events.methods.reflection.interpreting.EventMethodMapping.mapEvent(EventMethodMapping.java:73) at com.opencredo.concursus.mapping.events.methods.reflection.dispatching.EventDispatchers.lambda$toFactoryMethod$0(EventDispatchers.java:22) at com.opencredo.concursus.mapping.events.methods.reflection.dispatching.EventDispatchers$TypeMappingInitialEventDispatcher.apply(EventDispatchers.java:87) at com.opencredo.concursus.mapping.events.methods.reflection.dispatching.EventDispatchers$TypeMappingInitialEventDispatcher.apply(EventDispatchers.java:71) at com.opencredo.concursus.mapping.events.methods.state.DispatchingStateBuilder.accept(DispatchingStateBuilder.java:90) at com.opencredo.concursus.mapping.events.methods.state.DispatchingStateBuilder.accept(DispatchingStateBuilder.java:18) at com.opencredo.concursus.mapping.events.methods.proxying.EventEmittingProxy.invoke(EventEmittingProxy.java:49) at com.sun.proxy.$Proxy8.created(Unknown Source) at com.opencredo.concursus.examples.StateBuildingExample.buildStateFromEvents(StateBuildingExample.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Many other test in other modules fail as well and they all seem to reference the TupleSchema

pgremo avatar Apr 21 '16 19:04 pgremo

If you're running in intellij, you need to set the -parameters compiler argument, otherwise parameter names won't be picked up and everything that uses concursus-mapping to map method signatures to tuple schemas will fail.

poetix avatar Apr 21 '16 19:04 poetix

Have same error running spring boot example from cli

dimitrichkhartishvili avatar May 21 '16 16:05 dimitrichkhartishvili

Hopefully, this note will help the next person looking for the -parameters compiler argument so that reflection works as expected.

The page Obtaining Names of Method Parameters notes that the javac compiler requires the -parameters option so that the Reflection API can retrieve the formal parameter names.

josephwinston avatar Oct 25 '16 21:10 josephwinston