Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » moxy is not able to convert a List<String> to JSON(SEVERE: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=java.util.List<java.lang.String>.)
moxy is not able to convert a List<String> to JSON [message #1753162] Thu, 02 February 2017 10:53 Go to next message
Sigi Mising name is currently offline Sigi Mising nameFriend
Messages: 4
Registered: March 2011
Junior Member
Hi,

i'm using Tomcat, Jersey and Moxy. I have an issue understanding the general problem and how to handle it the 'proper' way:

Jersey is using moxy to transform objects to json. This works out of the box without issues with Classes i wrote.

When using a List<SomeType> i have to wrap this List in a GenericEntity like so:
new GenericEntity<List<Test>>(tests){};


Now this is a issue but most desturbing to me, the following doesn't work at all:
new GenericEntity<List<String>>(names){};



I get the following exception:
SEVERE: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=java.util.List<java.lang.String>.


Now for specific questions i have:

  • Isn't it the job of moxy to convert java objects to xml/json?
  • If so why can it handle String and custome Classes but not something so basic like a List?
  • What is the proper way of handling the List<X> issue?
  • What is the proper way of handling the List<String> issue?
  • Is there a standard which needs to be changed so that moxy can support this? What would be a way to put it into moxy?


Tx!

Sigi


Re: moxy is not able to convert a List<String> to JSON [message #1753186 is a reply to message #1753162] Thu, 02 February 2017 14:41 Go to previous messageGo to next message
Joachim Kanbach is currently offline Joachim KanbachFriend
Messages: 2
Registered: July 2009
Junior Member
This most likely has the same cause as described here here.
Re: moxy is not able to convert a List<String> to JSON [message #1753645 is a reply to message #1753186] Wed, 08 February 2017 12:39 Go to previous messageGo to next message
Sigi Mising name is currently offline Sigi Mising nameFriend
Messages: 4
Registered: March 2011
Junior Member
Tx a lot for the hint to this issue.

It makes me wonder very much why it is still open. As i stated in the issue reported: Isn't it a huge issue for moxy?

Is there any specific decision behind this?
Re: moxy is not able to convert a List<String> to JSON [message #1755307 is a reply to message #1753645] Thu, 02 March 2017 09:41 Go to previous message
Sigi Mising name is currently offline Sigi Mising nameFriend
Messages: 4
Registered: March 2011
Junior Member
Is there any thing i can do to help?
Previous Topic:duplicate tenant_id in WHERE clause for @Multitenant
Next Topic:Eclipselink ElementCollection Duplicates
Goto Forum:
  


Current Time: Sat Nov 18 14:21:57 GMT 2017

Powered by FUDForum. Page generated in 0.01458 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software