users@jersey.java.net

[Jersey] POJOMapping to Json in Google AppEngine

From: Nilsen Labs <nilsnett_at_gmail.com>
Date: Thu, 31 Jan 2013 11:35:13 -0000

Have anyone made Jersey work at Google AppEngine with POJO Mapping to JSON?
I've been spending some hours on getting this working now, but I'm stuck at
two places. Running locally at Jetty I get one step further than at
AppEngine, but I'm not there yet either. Here are the two problems I am
encountering:

--Locally--:
Jetty produces the following error:
SEVERE: A message body writer for Java class
nilsnett.chinese.backend.BusinessObject, and Java type class
nilsnett.chinese.backend.BusinessObject, and MIME media type
application/json was not found

"nilsnett.chinese.backend.BusinessObject" is a plain Java class I've created
that looks like this:

    package nilsnett.chinese.backend;
    import javax.xml.bind.annotation.XmlRootElement;
    public class BusinessObject {
        public String text;
        public int value;
    }

  --At AppEngine--:
Uncaught exception from servlet
java.lang.IncompatibleClassChangeError.

Now I had this error locally as well, and it's related to the fact that I'm
both referring asm-3.3.1.jar, which Jersey depends on, and asm-4.0.jar,
which AppEngine depends on. If I _only_ referenced asm-4.0.jar locally, I
would get the same error here. Referencing both does obviously not work well
at AppEngine.

--More data--:
Full Jetty log of local error here: http://pastebin.com/prKm23p2
Full exception log from AppEngine here: http://pastebin.com/XTpwsvhN
My web.xml: http://pastebin.com/YaEGuFEa

SDK's referenced:
   AppEngine v1.7.4
   Java SE 1.6
Jar's relevant to Jersey referenced:
   Jersey-bundle-1.17.jar
   Asm-3.3.1.jar
   Jettison-1.1jar

Developing in Eclipse Juno on Windows 8.

I'm

Any help would be greatly appreciated.

Frode Nilsen