jworkflow
jworkflow copied to clipboard
While Sample (05) with MongoDB persistence data binding issue
When trying to run Sample 05 from current master branch with MongoDB persistence
Added in Line 18 of Main class
module.usePersistence(MongoPersistenceService.configure("mongodb://localhost:27017/jworkflow"));
I get the following exception:
java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class net.jworkflow.kernel.models.ExecutionPointer (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; net.jworkflow.kernel.models.ExecutionPointer is in unnamed module of loader 'app')
at java.base/java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.allMatch(ReferencePipeline.java:533)
at net.jworkflow.kernel.models.WorkflowInstance.isBranchComplete(WorkflowInstance.java:113)
at net.jworkflow.primitives.While.run(While.java:34)
at net.jworkflow.kernel.services.DefaultWorkflowExecutor.execute(DefaultWorkflowExecutor.java:80)
at net.jworkflow.kernel.services.WorkflowWorker.executeItem(WorkflowWorker.java:45)
at net.jworkflow.kernel.services.QueueWorker.run(QueueWorker.java:41)
at net.jworkflow.kernel.services.QueueWorker.lambda$start$0(QueueWorker.java:53)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Do I need to specify additional Jackson "hints" do get the marshalling working with MongoDB? Thanks in advance.
After further debugging, it seems like this is a mapping issue of Spring Data MongoDB and in newer versions the MongoDB representation as Map
cannot be converted anymore to net.jworkflow.kernel.models.ExecutionPointer
. If turning back the dependencies to version 1.10.6 (from 1.10.7 on the above exception happens):
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.10.6.RELEASE</version>
</dependency>