Hi Christopher,

That looks like a bug, would you please open a report for it? 

Thank you,
 —Alex 

> On Mar 23, 2025, at 21:52, Christoffer Emil Kristensen <c...@itu.dk.invalid> 
> wrote:
> 
> Hello everyone,
> 
> We are two students from the IT-University at Copenhagen working on creating 
> a web interface for Apache Wayang as part of our master thesis. 
> 
> We are currently working with the REST api to execute a wayang plan. I have a 
> few questions though.
> 
> When i try to run the plan which is an example in the repo: 
> https://github.com/apache/incubator-wayang/blob/main/wayang-api/wayang-api-json/src/test/resources/test-plan-a.json
>  
> <https://www.google.com/url?q=https://github.com/apache/incubator-wayang/blob/main/wayang-api/wayang-api-json/src/test/resources/test-plan-a.json&source=gmail-imap&ust=1743367966000000&usg=AOvVaw1SR8clzuiWewqIRRClZGwr>
> 
> I get the following error:
> 
> 
> 
> 
> I submit the pla through postman at the following url: 
> http://localhost:8080/wayang-api-json/submit-plan/json 
> <https://www.google.com/url?q=http://localhost:8080/wayang-api-json/submit-plan/json&source=gmail-imap&ust=1743367966000000&usg=AOvVaw0cpYF3QFzZlBJcWdHIwXsK>
> 
> With the JSON test-plan-a. And my header only contain Content-Type 
> application/json
> 
> If i for example, try to run another example without the context specified in 
> the wayang plan i get a deserialization error. Does anyone have any 
> documentation on how to use the API and if i am missing something.
> 
> Btw i would assume that running the plan gave me an error as i might not have 
> access to the specified filepath, but i would assume that if this was the 
> problem i would receive another error.
> 
> This is the entire error:
> java.lang.NullPointerException
>         at 
> org.apache.wayang.api.json.builder.JsonPlanBuilder.setConfiguration(JsonPlanBuilder.scala:107)
>         at 
> org.apache.wayang.api.json.builder.JsonPlanBuilder.fromPlan(JsonPlanBuilder.scala:82)
>         at 
> org.apache.wayang.api.json.Main$.$anonfun$jsonRoute$7(Main.scala:57)
>         at 
> zio.ZIOCompanionVersionSpecific.$anonfun$attempt$1(ZIOCompanionVersionSpecific.scala:100)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:904)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:890)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:890)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:890)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:1024)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:1024)
>         at zio.internal.FiberRuntime.evaluateEffect(FiberRuntime.scala:381)
>         at zio.internal.FiberRuntime.start(FiberRuntime.scala:1339)
>         at zio.Runtime$UnsafeAPIV1.runOrFork(Runtime.scala:160)
>         at zio.http.netty.NettyRuntime.run(NettyRuntime.scala:52)
>         at zio.http.netty.NettyRuntime.run$(NettyRuntime.scala:29)
>         at zio.http.netty.NettyRuntime$$anon$1.run(NettyRuntime.scala:105)
>         at 
> zio.http.netty.server.ServerInboundHandler.writeResponse(ServerInboundHandler.scala:300)
>         at 
> zio.http.netty.server.ServerInboundHandler.channelRead0(ServerInboundHandler.scala:96)
>         at 
> zio.http.netty.server.ServerInboundHandler.channelRead0(ServerInboundHandler.scala:42)
>         at 
> io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.handler.flush.FlushConsolidationHandler.channelRead(FlushConsolidationHandler.java:152)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
>         at 
> io.netty.handler.codec.http.HttpServerKeepAliveHandler.channelRead(HttpServerKeepAliveHandler.java:64)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
>         at 
> io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
>         at 
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
>         at 
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
>         at 
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
>         at 
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
>         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
>         at 
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
>         at 
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>         at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>         at java.base/java.lang.Thread.run(Thread.java:829)
> 
> 
> And when running without the context, as per the following example: 
> https://github.com/apache/incubator-wayang/blob/main/wayang-api/wayang-api-json/src/test/resources/test-plan-a.json
>  
> <https://www.google.com/url?q=https://github.com/apache/incubator-wayang/blob/main/wayang-api/wayang-api-json/src/test/resources/test-plan-a.json&source=gmail-imap&ust=1743367966000000&usg=AOvVaw1SR8clzuiWewqIRRClZGwr>
> 
> I get the error:
> 
> com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot 
> deserialize value of type 
> `org.apache.wayang.api.json.operatorfromjson.PlanFromJson` from Array value 
> (token `JsonToken.START_ARRAY`)
>  at [Source: (String)"[
>   {
>     "id": 1,
>     "cat": "input",
>     "input": [],
>     "output": [2],
>     "operatorName": "textFileInput",
>     "data": {
>       "filename": "file:///home/mike/json-api-examples/in1.txt"
>     }
>   },
>   {
>     "id": 2,
>     "cat": "unary",
>     "input": [1],
>     "output": [3],
>     "operatorName": "map",
>     "data": {
>       "udf": "(s: String) => s.toInt"
>     }
>   },
>   {
>     "cat": "composed",
>     "operatorName": "composed",
>     "operators": [
>       {
>         "id": 3,
>         "cat": "unary",
>         "[truncated 716 chars]; line: 1, column: 1]
>         at 
> com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
>         at 
> com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1752)
>         at 
> com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1526)
>         at 
> com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1473)
>         at 
> com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeFromArray(BeanDeserializer.java:656)
>         at 
> com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:211)
>         at 
> com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:187)
>         at 
> com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
>         at 
> com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825)
>         at 
> com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3772)
>         at 
> com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3755)
>         at 
> org.apache.wayang.api.json.parserutil.ParsePlanFromJson$.parsePlanFromString(ParsePlanFromJson.scala:38)
>         at 
> org.apache.wayang.api.json.Main$.$anonfun$jsonRoute$5(Main.scala:56)
>         at scala.util.Try$.apply(Try.scala:213)
>         at 
> org.apache.wayang.api.json.Main$.$anonfun$jsonRoute$4(Main.scala:56)
>         at 
> zio.ZIOCompanionVersionSpecific.$anonfun$attempt$1(ZIOCompanionVersionSpecific.scala:100)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:904)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:890)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:890)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:890)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:890)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:1024)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:967)
>         at zio.internal.FiberRuntime.runLoop(FiberRuntime.scala:1024)
>         at zio.internal.FiberRuntime.evaluateEffect(FiberRuntime.scala:381)
>         at zio.internal.FiberRuntime.start(FiberRuntime.scala:1339)
>         at zio.Runtime$UnsafeAPIV1.runOrFork(Runtime.scala:160)
>         at zio.http.netty.NettyRuntime.run(NettyRuntime.scala:52)
>         at zio.http.netty.NettyRuntime.run$(NettyRuntime.scala:29)
>         at zio.http.netty.NettyRuntime$$anon$1.run(NettyRuntime.scala:105)
>         at 
> zio.http.netty.server.ServerInboundHandler.writeResponse(ServerInboundHandler.scala:300)
>         at 
> zio.http.netty.server.ServerInboundHandler.channelRead0(ServerInboundHandler.scala:96)
>         at 
> zio.http.netty.server.ServerInboundHandler.channelRead0(ServerInboundHandler.scala:42)
>         at 
> io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.handler.flush.FlushConsolidationHandler.channelRead(FlushConsolidationHandler.java:152)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
>         at 
> io.netty.handler.codec.http.HttpServerKeepAliveHandler.channelRead(HttpServerKeepAliveHandler.java:64)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
>         at 
> io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
>         at 
> io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
>         at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
>         at 
> io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
>         at 
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
>         at 
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
>         at 
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
>         at 
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
>         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
>         at 
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
>         at 
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>         at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>         at java.base/java.lang.Thread.run(Thread.java:829)
> org.apache.wayang.api.json.exception.WayangApiJsonException: Can't parse json 
> plan.
> 
> 
> 
> Best regards,
> 
> Christoffer Kristensen


-- 
*Scalytics Connect*
The foundation for secure, scalable, and transparent 
AI.



--
3401 N. MIAMI AVE. STE 230
33127 Miami, Florida 
United States
www.scalytics.io <http://www.scalytics.io>

--  Please consider the 
environment before printing this email --

Disclaimer:
The content of this 
message is confidential. If you have received it by mistake, please inform 
us by an email reply and then delete the message. It is forbidden to copy, 
forward, or in any way reveal the contents of this message to anyone. The 
integrity and security of this email cannot be guaranteed over the 
Internet. Therefore, the sender will not be held liable for any damage 
caused by the message.

Reply via email to