You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Martin Strohal <ma...@1und1.de> on 2016/04/14 14:33:01 UTC

JAX-RS endpoint not found

Hi,

I am using TomEE 1.7.1 with cxf 2.6.14 and openejb 4.7.1.

I have implemented a REST service anotated with @Path etc.
If I call this REST service I always get a 404 error, even if the log
said before that the REST Service is bound to my Java class.

I have debugged a lot and found a strange thing in JAXRSInInterceptor
(cxf-rt-frontend-jaxrs-2.6.14). There is a variable rawPath within the
method processRequest (line 129).
This variable is filled by calling HttpUtils.getPathToMatch. And this
method only returns the last part of my URL. The URL part of the @Path
annotation of my class is missing!
If I manually set the complete path (the part after the host name) in
the variable rawPath using Eclipse debugger, everything works fine.

Example:

@Path("/v1/users")
public class MyService {

  @Path("/hello")
  public String hello() {
    ...
  }
}

In my case the variable rawPath only contains "/hello", so no resource
is found. The variable resource is empty which results in a
WebApplicationException (line 162).
If the rawPath was "/v1/users/hello", the resource would be found and
everything works fine.

Is this a bug in cxf 2.6.14 (included in TomEE 1.7.1)? Or am I missing
some configuration stuff in my application?

Thank you very much for help!

Martin

Re: JAX-RS endpoint not found

Posted by Romain Manni-Bucau <rm...@gmail.com>.
your openejb-jar.xml is not well configured: <pojo-deployment
class-name="jaxrs-appication"> (dont use WsService)

Romain Manni-Bucau
@rmannibucau |  Blog | Github | LinkedIn | Tomitriber


2016-04-14 15:11 GMT+02:00 Martin Strohal <ma...@1und1.de>:
> I could isolate the problem and have uploaded the small project (for 48 hours):
>
> http://expirebox.com/download/c13cdc7bfc474f819bd399004881c171.html
>
> Just copy the included war into your webapps directory and call
>    curl -i "http://localhost:40000/rest-test-1.0.0-SNAPSHOT/v1/users/hello"
>
> Result will be a 404 with the following stacktrace:
>
>
> INFO   | jvm 1    | 2016/04/14 15:04:14 | WARNING: No root resource matching request path /rest-test-1.0.0-SNAPSHOT/v1/users/hello has
>  been found, Relative Path: /hello. Please enable FINE/TRACE log level for more details.
> INFO   | jvm 1    | 2016/04/14 15:04:14 | Apr 14, 2016 3:04:14 PM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
> INFO   | jvm 1    | 2016/04/14 15:04:14 | WARNING: javax.ws.rs.WebApplicationException
> INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInIntercept
> or.java:162)
> INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInIntercepto
> r.java:91)
> INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:2
> 63)
> INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.
> java:121)
> INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestinatio
> n.java:240)
> INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.onMessage(CxfRsHttpListener.java
> :187)
>
>
> Thanks for your help!
>
> Martin
> ________________________________________
> Von: Martin Strohal <ma...@1und1.de>
> Gesendet: Donnerstag, 14. April 2016 14:48
> An: users@tomee.apache.org
> Betreff: AW: JAX-RS endpoint not found
>
> Hi Romain
>
> thanks for your fast answer!
>
> It's a very complex project I have, I'll try to isolate it.
>
> TomEE is a self packaged one according to our inhouse rollout processes, but using all JARs from TomEE+ 1.7.1. openejb-cxf-rs (4.7.1) is included.
>
> Martin
>
>
> ________________________________________
> Von: Romain Manni-Bucau <rm...@gmail.com>
> Gesendet: Donnerstag, 14. April 2016 14:40
> An: users@tomee.apache.org
> Betreff: Re: JAX-RS endpoint not found
>
> Hi
>
> do you have any project reproducing it? Do you run a full tomee or
> another flavor (openejb-cxf-rs?)?
>
> Romain Manni-Bucau
> @rmannibucau |  Blog | Github | LinkedIn | Tomitriber
>
>
> 2016-04-14 14:33 GMT+02:00 Martin Strohal <ma...@1und1.de>:
>> Hi,
>>
>> I am using TomEE 1.7.1 with cxf 2.6.14 and openejb 4.7.1.
>>
>> I have implemented a REST service anotated with @Path etc.
>> If I call this REST service I always get a 404 error, even if the log
>> said before that the REST Service is bound to my Java class.
>>
>> I have debugged a lot and found a strange thing in JAXRSInInterceptor
>> (cxf-rt-frontend-jaxrs-2.6.14). There is a variable rawPath within the
>> method processRequest (line 129).
>> This variable is filled by calling HttpUtils.getPathToMatch. And this
>> method only returns the last part of my URL. The URL part of the @Path
>> annotation of my class is missing!
>> If I manually set the complete path (the part after the host name) in
>> the variable rawPath using Eclipse debugger, everything works fine.
>>
>> Example:
>>
>> @Path("/v1/users")
>> public class MyService {
>>
>>   @Path("/hello")
>>   public String hello() {
>>     ...
>>   }
>> }
>>
>> In my case the variable rawPath only contains "/hello", so no resource
>> is found. The variable resource is empty which results in a
>> WebApplicationException (line 162).
>> If the rawPath was "/v1/users/hello", the resource would be found and
>> everything works fine.
>>
>> Is this a bug in cxf 2.6.14 (included in TomEE 1.7.1)? Or am I missing
>> some configuration stuff in my application?
>>
>> Thank you very much for help!
>>
>> Martin

AW: JAX-RS endpoint not found

Posted by Martin Strohal <ma...@1und1.de>.
I could isolate the problem and have uploaded the small project (for 48 hours):

http://expirebox.com/download/c13cdc7bfc474f819bd399004881c171.html

Just copy the included war into your webapps directory and call
   curl -i "http://localhost:40000/rest-test-1.0.0-SNAPSHOT/v1/users/hello"

Result will be a 404 with the following stacktrace:


INFO   | jvm 1    | 2016/04/14 15:04:14 | WARNING: No root resource matching request path /rest-test-1.0.0-SNAPSHOT/v1/users/hello has
 been found, Relative Path: /hello. Please enable FINE/TRACE log level for more details.
INFO   | jvm 1    | 2016/04/14 15:04:14 | Apr 14, 2016 3:04:14 PM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
INFO   | jvm 1    | 2016/04/14 15:04:14 | WARNING: javax.ws.rs.WebApplicationException
INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInIntercept
or.java:162)
INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInIntercepto
r.java:91)
INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:2
63)
INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.
java:121)
INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestinatio
n.java:240)
INFO   | jvm 1    | 2016/04/14 15:04:14 |       at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.onMessage(CxfRsHttpListener.java
:187)


Thanks for your help!

Martin
________________________________________
Von: Martin Strohal <ma...@1und1.de>
Gesendet: Donnerstag, 14. April 2016 14:48
An: users@tomee.apache.org
Betreff: AW: JAX-RS endpoint not found

Hi Romain

thanks for your fast answer!

It's a very complex project I have, I'll try to isolate it.

TomEE is a self packaged one according to our inhouse rollout processes, but using all JARs from TomEE+ 1.7.1. openejb-cxf-rs (4.7.1) is included.

Martin


________________________________________
Von: Romain Manni-Bucau <rm...@gmail.com>
Gesendet: Donnerstag, 14. April 2016 14:40
An: users@tomee.apache.org
Betreff: Re: JAX-RS endpoint not found

Hi

do you have any project reproducing it? Do you run a full tomee or
another flavor (openejb-cxf-rs?)?

Romain Manni-Bucau
@rmannibucau |  Blog | Github | LinkedIn | Tomitriber


2016-04-14 14:33 GMT+02:00 Martin Strohal <ma...@1und1.de>:
> Hi,
>
> I am using TomEE 1.7.1 with cxf 2.6.14 and openejb 4.7.1.
>
> I have implemented a REST service anotated with @Path etc.
> If I call this REST service I always get a 404 error, even if the log
> said before that the REST Service is bound to my Java class.
>
> I have debugged a lot and found a strange thing in JAXRSInInterceptor
> (cxf-rt-frontend-jaxrs-2.6.14). There is a variable rawPath within the
> method processRequest (line 129).
> This variable is filled by calling HttpUtils.getPathToMatch. And this
> method only returns the last part of my URL. The URL part of the @Path
> annotation of my class is missing!
> If I manually set the complete path (the part after the host name) in
> the variable rawPath using Eclipse debugger, everything works fine.
>
> Example:
>
> @Path("/v1/users")
> public class MyService {
>
>   @Path("/hello")
>   public String hello() {
>     ...
>   }
> }
>
> In my case the variable rawPath only contains "/hello", so no resource
> is found. The variable resource is empty which results in a
> WebApplicationException (line 162).
> If the rawPath was "/v1/users/hello", the resource would be found and
> everything works fine.
>
> Is this a bug in cxf 2.6.14 (included in TomEE 1.7.1)? Or am I missing
> some configuration stuff in my application?
>
> Thank you very much for help!
>
> Martin

AW: JAX-RS endpoint not found

Posted by Martin Strohal <ma...@1und1.de>.
Hi Romain

thanks for your fast answer!

It's a very complex project I have, I'll try to isolate it.

TomEE is a self packaged one according to our inhouse rollout processes, but using all JARs from TomEE+ 1.7.1. openejb-cxf-rs (4.7.1) is included.

Martin


________________________________________
Von: Romain Manni-Bucau <rm...@gmail.com>
Gesendet: Donnerstag, 14. April 2016 14:40
An: users@tomee.apache.org
Betreff: Re: JAX-RS endpoint not found

Hi

do you have any project reproducing it? Do you run a full tomee or
another flavor (openejb-cxf-rs?)?

Romain Manni-Bucau
@rmannibucau |  Blog | Github | LinkedIn | Tomitriber


2016-04-14 14:33 GMT+02:00 Martin Strohal <ma...@1und1.de>:
> Hi,
>
> I am using TomEE 1.7.1 with cxf 2.6.14 and openejb 4.7.1.
>
> I have implemented a REST service anotated with @Path etc.
> If I call this REST service I always get a 404 error, even if the log
> said before that the REST Service is bound to my Java class.
>
> I have debugged a lot and found a strange thing in JAXRSInInterceptor
> (cxf-rt-frontend-jaxrs-2.6.14). There is a variable rawPath within the
> method processRequest (line 129).
> This variable is filled by calling HttpUtils.getPathToMatch. And this
> method only returns the last part of my URL. The URL part of the @Path
> annotation of my class is missing!
> If I manually set the complete path (the part after the host name) in
> the variable rawPath using Eclipse debugger, everything works fine.
>
> Example:
>
> @Path("/v1/users")
> public class MyService {
>
>   @Path("/hello")
>   public String hello() {
>     ...
>   }
> }
>
> In my case the variable rawPath only contains "/hello", so no resource
> is found. The variable resource is empty which results in a
> WebApplicationException (line 162).
> If the rawPath was "/v1/users/hello", the resource would be found and
> everything works fine.
>
> Is this a bug in cxf 2.6.14 (included in TomEE 1.7.1)? Or am I missing
> some configuration stuff in my application?
>
> Thank you very much for help!
>
> Martin

Re: JAX-RS endpoint not found

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

do you have any project reproducing it? Do you run a full tomee or
another flavor (openejb-cxf-rs?)?

Romain Manni-Bucau
@rmannibucau |  Blog | Github | LinkedIn | Tomitriber


2016-04-14 14:33 GMT+02:00 Martin Strohal <ma...@1und1.de>:
> Hi,
>
> I am using TomEE 1.7.1 with cxf 2.6.14 and openejb 4.7.1.
>
> I have implemented a REST service anotated with @Path etc.
> If I call this REST service I always get a 404 error, even if the log
> said before that the REST Service is bound to my Java class.
>
> I have debugged a lot and found a strange thing in JAXRSInInterceptor
> (cxf-rt-frontend-jaxrs-2.6.14). There is a variable rawPath within the
> method processRequest (line 129).
> This variable is filled by calling HttpUtils.getPathToMatch. And this
> method only returns the last part of my URL. The URL part of the @Path
> annotation of my class is missing!
> If I manually set the complete path (the part after the host name) in
> the variable rawPath using Eclipse debugger, everything works fine.
>
> Example:
>
> @Path("/v1/users")
> public class MyService {
>
>   @Path("/hello")
>   public String hello() {
>     ...
>   }
> }
>
> In my case the variable rawPath only contains "/hello", so no resource
> is found. The variable resource is empty which results in a
> WebApplicationException (line 162).
> If the rawPath was "/v1/users/hello", the resource would be found and
> everything works fine.
>
> Is this a bug in cxf 2.6.14 (included in TomEE 1.7.1)? Or am I missing
> some configuration stuff in my application?
>
> Thank you very much for help!
>
> Martin