Payara 5.181 doesn't work with RESTFul web service

1,223 views
Skip to first unread message

Jedi Sal

unread,
Mar 22, 2018, 4:11:29 PM3/22/18
to Payara Forum
Hi All, 
I have web application that it run amazing over Payara 4.2.181 server. This application uses Restful web services to extract data from the server database. When I change the server to Payara 5.181 server, It compiles and runs but when I use the first web service to login, I get the following error:

Severe:   Generating incomplete JSON
Warning:   StandardWrapperValve[webservices.ApplicationConfig]: Servlet.service() for servlet webservices.ApplicationConfig threw exception
java.lang.StackOverflowError

This is what I know so far after debugging in Netbeans 8.2:
  • client call web service : Good
  • server receives web service call: Good
  • server retrieves data from database: Good
  • server return data in a response object: Good
  • server converts entity and response objects into a Json object for transfer via HTTP protocol : Bad
  • client receives http response error code 500 : Good
  • payara server shows error above
the problem seems to be right before the response is converted to json for transfer. My entities have the @Entity and @XmlRootElement which allow the conversion from Java to Json objects. 

Does anyone knows why this is happening? is there an Annotation i need to add for Payara 5.181 and beyong? 

please help....



Ondro Mihályi

unread,
Mar 27, 2018, 4:56:28 AM3/27/18
to Jedi Sal, Payara Forum
Hi Jedi,

A general advice would be to change the JAXB annotation for JSON-B annotations, which are part of Java EE 8 and are supported by Payara 5. Using JAXB annotations to map to JSON is non-standard and non-portable and may not work in Payara 5 out of the box.

Payara 4 uses Moxy, which reads JAXB annotations to map to JSON. On the other hand, Payara 5 uses (Yasson) that only supports the new JSON-B annotations. To support JAXB annotations, you would have to enable the old Moxy JAX-RS MessageBodyReader and writer to override the default configuration. I recommend searching the internet for more information. I won't give you hints how to do that now because I've never done it and I would have to search for the solution myself.

Ondro

--
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/71d51307-78c6-471c-9784-fb7a05001d63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Mohannd Lababidy

unread,
Jun 23, 2018, 6:54:31 PM6/23/18
to Payara Forum
you can add @JsonbTransientint to disable this behavior.

this annotation equivalent to @XmlTransient for XML generation but for Josonb

I used NetBeans to generate Rest Endpoints and add  @JsonbTransient in everywhere @XmlTransient is exist


 

Jedi Sal

unread,
Feb 4, 2019, 10:08:24 PM2/4/19
to Payara Forum
where do you get the json-b jar file? or this is included into the payara server 5.184 files? i tried to add @Jasonbtransient but i guess i dont have the library. I tried to download the jar file but i cant find where...

please help...

Jedi Sal

unread,
Feb 5, 2019, 3:45:32 PM2/5/19
to Payara Forum

Hi, 

I need help. Everywhere I searched it says to used @JasonbTransient instead of @XmlTransient. I have done that but still gives me incomplete JSON errorNetbeans creates the entities with JAXB annotations and It looks like payara server 5.184 doesn't work with JAXB anymore. It works fine with 4.1.2.xxx payara servers. I want to switch my applications to Payara 5.xx but this is stopping me. There is also another annotation that might be causing the problem: @XmlRootElement. No one says anything about this one.

Example of entity:

@Entity
@Table(name = "usertable")
@XmlRootElement
public class Usertable implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idusertable")
    private Integer idusertable;
    @Column(name = "datecreated")
    @Basic(optional = false)
    @Column(name = "email")
    private String email = "";
    @Basic(optional = false)
    @Column(name = "password")
    private String password = "";
    @OneToMany(mappedBy = "iduser")
    private Collection<Propertytable> propertytableCollection;    
    // Transient variables
    @Transient
    private String ans1decrypted = "", ans2decrypted = "", ans3decrypted = "";

    // GETTERS AND SETTERS AND CONSTRUCTORS 
    // PLUS
    //@XmlTransient
    @JsonbTransient
    public Collection<Propertytable> getPropertytableCollection() {
        return propertytableCollection;
    }
}

As you can see I have commented out @XmlTransient and added @JasonbTransient in the getter causing the problem. Do I need to do anything with @XmlRootElement? has anyone gone through this issue with the new Payara 5.*?

please help... your help will be appreciated.

To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.

Jedi Sal

unread,
Feb 5, 2019, 3:51:53 PM2/5/19
to Payara Forum
I figure out where, it is included on the package: javax.jason.bind.annotation.JasonbTransient, not need to get a jar file. 

Captain

unread,
Feb 24, 2019, 2:01:48 PM2/24/19
to Payara Forum
THANK YOU SOO MUCH!! You just saved me
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.

Ondro Mihályi

unread,
Feb 24, 2019, 3:58:37 PM2/24/19
to Jedi Sal, Payara Forum
Hi,

If you have a maven project, just use javaee dependency in version 8 instead of 7.

If you have a default Netbeans project, then it's a bit harder because Netbeans 8.2 doesn't support JavaEE 8, only 7. You should add this JAR to your app: https://search.maven.org/artifact/javax.json.bind/javax.json.bind-api/1.0/jar

Dňa ut 5. 2. 2019, 4:08 Jedi Sal <chs...@gmail.com> napísal(a):
--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages