0

Well, as the title says since I've tried to add Genson it broke my application. Now I'm not 100% sure it has to do with Payara, but reading the error log it most certainly is.

I've added Genson to my Pom.xml, wrote some code to serialize and deserialize an object. Launched my application (deployment via Payara) went to my API and received the following error on the webpage:

java.lang.AbstractMethodError: com.owlike.genson.ext.jsr353.GensonJsonGenerator.writeKey(Ljava/lang/String;)Ljavax/json/stream/JsonGenerator;

After lots of debugging and googling I decided to remove the genson alltogether and maybe find another solution.

But now my application won't work anymore, it deploys and loads my welcome page, but as soon as i go to one of my api points I receive.

java.lang.AbstractMethodError: com.owlike.genson.ext.jsr353.GensonJsonGenerator.writeKey(Ljava/lang/String;)Ljavax/json/stream/JsonGenerator;
java.lang.AbstractMethodError: com.owlike.genson.ext.jsr353.GensonJsonGenerator.writeKey(Ljava/lang/String;)Ljavax/json/stream/JsonGenerator;
    at org.eclipse.yasson.internal.serializer.ObjectSerializer.marshallProperty(ObjectSerializer.java:88)
    at org.eclipse.yasson.internal.serializer.ObjectSerializer.serializeInternal(ObjectSerializer.java:61)
    at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serialize(AbstractContainerSerializer.java:63)
    at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serializerCaptor(AbstractContainerSerializer.java:95)
    at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serializeItem(AbstractContainerSerializer.java:141)
    at org.eclipse.yasson.internal.serializer.CollectionSerializer.serializeInternal(CollectionSerializer.java:39)
    at org.eclipse.yasson.internal.serializer.CollectionSerializer.serializeInternal(CollectionSerializer.java:27)
    at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serialize(AbstractContainerSerializer.java:63)
    at org.eclipse.yasson.internal.Marshaller.serializeRoot(Marshaller.java:118)
    at org.eclipse.yasson.internal.Marshaller.marshall(Marshaller.java:74)
    at org.eclipse.yasson.internal.JsonBinding.toJson(JsonBinding.java:98)
    at org.glassfish.jersey.jsonb.internal.JsonBindingProvider.writeTo(JsonBindingProvider.java:118)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:266)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:251)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:163)
    at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:109)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:163)
    at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:85)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:163)
    at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1137)
    at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:662)
    at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:395)
    at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:385)
    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:280)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:704)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1628)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:258)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:755)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:575)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
    at java.lang.Thread.run(Thread.java:748)
]]

and on the page itself the java.lang.AbstractMethodError: com.owlike.genson.ext.jsr353.GensonJsonGenerator.writeKey(Ljava/lang/String;)Ljavax/json/stream/JsonGenerator;

I would REALLY appreciate it if someone knows what this could be, because this is really stressing me out.., or how I can at least revert it. Thanks so much in advance.

EDIT: Maybe some useful information, I started receiving this after trying to add Websocket support. I created a class starting with
@ServerEndpoint(value = "/serverwsendpoint", encoders = SomethingEncoder.class, decoders = SomethingDecoder.class)

Maybe somewhere in Payara this endpoint is still there, giving me encoding/decoding errors even though I do nothing with them anymore.

Déjà vu
  • 774
  • 2
  • 9
  • 31
  • You are getting this error because in the new version of the JSON-P spec there are breaking changes in the API. They have added a writeKey method that now must be implemented. Genson was implemented against JSON-P v1 which didn't have this method. It seems that at runtime you're using the new JSON-P version. The change in Genson to support this is some work so I'd recommend not using Genson in this case. – eugen May 23 '19 at 18:00
  • @eugen Hey, thank you for responding! After trying to remove Genson out of my application i still won't work. I removed all Genson from the code. I removed the dependencies from the pom.xml. Is there anything I might have forgotten? – Déjà vu May 29 '19 at 17:55
  • @Déjàvu were you able to resolve this error – ken4ward Jul 19 '19 at 17:12
  • @kehinde Sorry for the VERY late response, but no I never managed to figure the problem out... I will try your answer when I have the time to see if it works. At least then maybe other people will be helped! – Déjà vu Sep 25 '19 at 08:29

1 Answers1

1

Maybe this could help resolve the issue. I switched to jersey-bom version 2.28, genson 1.5, and the APIs started working again.

<dependency>
   <groupId>org.glassfish.jersey</groupId>
   <artifactId>jersey-bom</artifactId>
   <version>2.28</version>
   <type>pom</type>
   <scope>import</scope>
</dependency>
<dependency>
  <groupId>com.owlike</groupId>
  <artifactId>genson</artifactId>
  <version>1.5</version>
</dependency>
ken4ward
  • 2,246
  • 5
  • 49
  • 89