Classloading problems while attempting to use JSON-B/Yasson in Payara 4.1.2.181

1,007 views
Skip to first unread message

Phillip Ross

unread,
Jun 26, 2018, 12:51:21 AM6/26/18
to Payara Forum
Hi all,

I'm trying to get JSON-B (yasson) to work in Pyara 4.1.2.181 and am getting the following error:
Caused by: java.lang.NoSuchMethodError: javax.json.stream.JsonGenerator.writeKey(Ljava/lang/String;)Ljavax/json/stream/JsonGenerator;

I believe this is due to yasson depending on a newer version of JSON-P than what Payara4 ships with.  I've put yasson and JSON-P jars in my webapp and tried to turn off classloader delegation, but I still get the error.  Is there some trick I'm not aware of to get this to work, or is it just a limitation of Payara4?

Details:
- Included in my war's WEB-INF/lib I have the following:
javax.json-1.1.jar
javax.json-api-1.1.jar
javax.json.bind-api-1.0.jar
yasson-1.0.2-SNAPSHOT-07-05-2018.payara-p1.jar

Included in my war's WEB-INF, i have glassfish-web.xml with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
    <class-loader delegate="true"/>
</glassfish-web-app>

Phillip Ross

unread,
Jun 26, 2018, 12:55:42 AM6/26/18
to Payara Forum
Correct, the delegate attribute is set to "false" in glassfish-web.xml

The error actually occurs whether the value is true or false.

Ondro Mihályi

unread,
Jun 26, 2018, 5:29:47 PM6/26/18
to Phillip Ross, Payara Forum
Hi Phillip,

It's not possible to disable loading of the JSON-P classes included in Payara Server. Although Payara Server supports even stronger classpath isolation than GlassFish server with the Extreme Classloading Isolation, JSON-P and all Java EE API are essential and cannot be removed from the classpath.

The only way to make Yasson working would be patching the JSON-P modules in glassfish/modules directory with newer version of JSON-P or removing those modules completely. None of these is guaranteed to work though.

It's better to upgrade to Payara 5.

All the best,
Ondrej

--
You received this message because you are subscribed to the Google Groups "Payara Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/60df68d0-adba-49c7-95fd-e4d7dfbde32c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Phillip Ross

unread,
Jun 26, 2018, 5:45:36 PM6/26/18
to Payara Forum
That's what I suspected.  I've already begun to upgrade to payara5 but that's proving to be a real chore thanks to apparent problems with grizzly http2 and eclipselink :(  I think I'm going to be forced to punt on JSON-B and use jackson databinding instead.

Thanks for your help!
- Phillip
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.

Steve Millidge (Payara)

unread,
Jun 26, 2018, 5:47:18 PM6/26/18
to Phillip Ross, Payara Forum

If you are having http2 issues disable http2 on your listener.


Could you elaborate on the EclipseLink and Grizzly issues?




From: payara...@googlegroups.com <payara...@googlegroups.com> on behalf of Phillip Ross <phillip....@gmail.com>
Sent: 26 June 2018 10:45 PM
To: Payara Forum
Subject: Re: [payara-forum] Re: Classloading problems while attempting to use JSON-B/Yasson in Payara 4.1.2.181
 

Ondro Mihályi

unread,
Jun 26, 2018, 5:59:24 PM6/26/18
to Phillip Ross, Payara Forum
What kind of issues do you have with HTTP/2 and Eclipselink in Payara 5?

Ondro

To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/732d9f72-5c75-4bc5-9a29-bfb07e1a3b5f%40googlegroups.com.

Phillip Ross

unread,
Jun 26, 2018, 6:04:31 PM6/26/18
to Payara Forum
Thanks Steve... it does seem that disabling http2 on the listeners works around the problems we're seeing with that, and with eclipselink I've not even had the time to troubleshoot the issue.  It seems to have something to do with flushing behavior or synchronization between persistence context and postgres.  It's going to take awhile to isolate the symptoms and narrow down the problem(s).  There are also some problems with date/time handling.  Putting together coherent reproducers is on the todo list. 
To unsubscribe from this group and stop receiving emails from it, send an email to payara-foru...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages