I have jersey REST channel deployed on weblogic. All methods are configured to return JSON data. Jersey is using jackson inside. One of this method is working all the time and is returning the correct data, but the other returns ‘null’. Literally, this means, ‘null’ is written on the screen. But the method definitely does not returns null, because I log everything.
There seems to be no error, since no error is printed in logs, and I set ‘INFO’ level for root logger in log4j configuration. So I’m a bit lost – no idea what can be wrong when no error is reported and simply null is returned. Anyone can help? How to at least find out what is wrong?
–edit–
In my case it was caused by missing getters/setters on fields of response class. There is a constructor, which was used by GSON, but not jersey/jackson. But the annoying thing is, this tools just returned null and not thrown any exception. So still, the question is, how to debug such errors, is it possible to force jersey/jackson to print the problems they find, and not such childisch behaviour 😉
I’ve dealt with the problem by using gson to serialize manually objects to JSON, and I declared the function returned type to
String, and I hadn’t any problems with deploying and using it under weblogic and with debugging errors, so this is my works-for-me solution that I would recommend to anyone having similar problems.