HI Sergey, I tryied your suggestion and I found the error no in the JAXRSOutInterceptor, but in the AbstactHTTPConnection class from Jetty. The exception contains following message:
java.lang.NoClassDefFoundError: javax/ws/rs/MessageProcessingException 2014-10-28 14:41 GMT+01:00 Sergey Beryozkin <[email protected]>: > Hi > On 28/10/14 13:32, Adrián Roselló Rey wrote: > >> Hi Sergey, >> >> Yep, that's exactly my problem. The server process the request, and the >> sayHello method returns the error instead of the String message. >> >> I can only think of the situation where the CXF out chain deals with > something non-initialized in this case which would otherwise be properly > initialized... > Can you please put a breakpoint in JAXRSOutInterceptor, given that you do > use a debugger, and see where 500 is coming from ? > > Thanks, Sergey > > > 2014-10-28 13:51 GMT+01:00 Sergey Beryozkin <[email protected]>: >> >> Hi >>> On 28/10/14 10:20, Adrián Roselló Rey wrote: >>> >>> Hello! >>>> >>>> I'm having some problems using JAX-RS to publish endpoints. I took as >>>> reference official documentation in following link, since I want to >>>> publish >>>> it programatically without using Spring: >>>> >>>> http://cxf.apache.org/docs/jaxrs-services-configuration.html# >>>> JAXRSServicesConfiguration-ConfiguringJAX- >>>> RSendpointsprogrammaticallywit >>>> houtSpring >>>> >>>> >>>> The RootResourceClass looks like this: >>>> >>>> >>>> *@Path("/")* >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> *public class sampleClass { @Path("/hello") @GET >>>> @Produces(MediaType.TEXT_PLAIN) public String sayHello() { >>>> return >>>> "hello"; }}* >>>> >>>> The endpoint was successfully published, since I could debug my code >>>> when >>>> I >>>> accessed this URI. But for unknown reasons, server always response with >>>> an >>>> internal server error. >>>> >>>> >>> Can you please clarify the above ? Are you saying that when you do >>> >>> curl -H "Accept: text/plain" -X GET http://localhost:8888/hello >>> >>> you can debug the server processing this request in its sayHello >>> implementation but then once sayHello() returns the error is returned >>> instead of the actual "hello" value ? >>> >>> Cheers, Sergey >>> >>> Please find an example of the request I did with >>>> curl: >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> * curl -H "Accept: text/plain" -X GET "http://localhost:8888/hello >>>> <http://localhost:8888/hello>" -v* Hostname was NOT found in DNS cache* >>>> Trying 127.0.0.1...* Connected to localhost (127.0.0.1) port 8888 (#0)> >>>> GET >>>> /hello HTTP/1.1> User-Agent: curl/7.35.0> Host: localhost:8888> Accept: >>>> text/plain> < HTTP/1.1 500 Server Error< Content-Length: 0< Connection: >>>> close* Server Jetty(8.1.14.v20131031) is not blacklisted< Server: >>>> Jetty(8.1.14.v20131031)< * Closing connection 0* >>>> >>>> There's no helpful information in the response. Any idea on what could >>>> be >>>> happening? >>>> >>>> Thanks and best regards, >>>> >>>> Adrián Roselló Rey >>>> >>>> >>>> >>> >>> >> >> > > -- *Adrián Roselló Rey Distributed Applications and Networks Area (DANA) i2CAT Foundation, Barcelona, Spain* T: +34 93 553 25 49 http://dana.i2cat.net
