Hi,
please see inline...
On 19.10.2011 16:52, reaganej_at_gmail.com wrote:
> Hello,
> I have a JSON JAXB context resolve like
> private final Class[] cTypes = {XCollection.class, Bill.class....};
>
> public JAXBContextResolver() throws Exception {
> this.types = new HashSet(Arrays.asList(cTypes));
> this.context = new
> JSONJAXBContext(JSONConfiguration.natural().build(), cTypes);
> }
>
> public JAXBContext getContext(Class<?> objectType) {
> return (types.contains(objectType)) ? context : null;
> }
>
> On the server side Jersey sends the request to my remote method and it
> gets a list of Bills. When I send a single Bill object back (e.g.
> public Bill getBill()...) then I get a server error saying a message
> body writter cannot be found. If I move the Bill class out of its
"Message body writer cannot be found" means that whatever your resource
method
returned back was not recognized by Jersey's JAXB message body writers
as a proper JAXB bean.
Then (unless you provide another writer by yourself) nobody tries to
even look up
any JAXB context resolver, and your resolver does not get hit.
When generated the above mentioned message, Jersey usually adds some
more detailed
information (class name, available providers, etc.). Could you please
send the whole message
to see what could be wrong there?
~Jakub
> current EJB project and copy it into a different EJB project I can get
> the Bill back just fine as XML.
>
> Additionally when I register a breakpoint on glassfish and attach
> my netbeans debugger to the getContext Method, the break point is never
> gets hit.
>
> I am wondering my my context resolver, which is in a separate web
> project serving up multiple bean web services, doesn't get called to
> provide for the Bill class which I have registered but will provide say
> a Payment class which is a different bean?
>
> I know I can run my Bill class through jaxb and have successfully
> marshalled/unmarshalled it with jaxb.
>
> I have added a jersey logging filter and I can see valid xml sent to
> the server when doing a put request but then get a response back of
> 415, which again leads me to believe that my context resolver isn't
> being used.
>
> Is there a way to trace through and see exactly where I am getting
> exceptions at?
>