You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by bks <bk...@yahoo.com> on 2011/06/03 01:13:41 UTC
404 with numeric IPv6 address in URL
CXF 2.3.1, Jetty 7.1.5
Hello,
We have an application using CXF for RESTful web services. It has been
working correctly on a IPv4 network for a long time.
I am trying to verify our application on IPv6. It works ok if I use a
nameservice hostname (/etc/hosts, DNS, etc.) in the URL, but I get a 404 if
I use the numeric IP address, using the convention of enclosing the IPv6
address in brackets. Using verbose cURL, I see this when it works:
[root@localhost local]# curl --verbose --basic --user xxxxx:xxxxxxxx --ipv6
'http://visionserver6/rws/mobile/devices'
* About to connect() to visionserver6 port 80
* Trying fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0... connected
* Connected to visionserver6 (fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0) port 80
* Server auth using Basic with user 'xxxxx'
> GET /rws/mobile/devices HTTP/1.1
> Authorization: Basic YWRtaW46cGFzc3dvcmQ=
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5
> OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: visionserver6
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Thu, 02 Jun 2011 22:01:27 GMT
< Transfer-Encoding: chunked
< Server: Jetty(7.x.y-SNAPSHOT)
[ snip -- returned JSON body deleted ]
* Connection #0 to host visionserver6 left intact
* Closing connection #0
and this when it fails:
[root@localhost local]# curl --verbose --basic --user xxxxx:xxxxxxxx --ipv6
'http://\[fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0\]/rws/mobile/devices'
* About to connect() to fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0 port 80
* Trying fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0... connected
* Connected to fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0
(fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0) port 80
* Server auth using Basic with user 'xxxxx'
> GET /rws/mobile/devices HTTP/1.1
> Authorization: Basic YWRtaW46cGFzc3dvcmQ=
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5
> OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: [fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0]
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/xml
< Date: Thu, 02 Jun 2011 21:58:40 GMT
< Content-Length: 0
< Server: Jetty(7.x.y-SNAPSHOT)
* Connection #0 to host fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0 left intact
* Closing connection #0
It looks like connection to the web server is succeeding, and the GET
command is the same in both cases. The only thing obviously different in
the request is the value of the Host header, and I believe that is correct
per RFC 2732.
I turned on CXF debug logging. In the successful case, nothing is logged;
when it fails, I get this:
Jun 2, 2011 3:58:39 PM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor
processRequest
WARNING: No root resource matching request path /rws/mobile/devices has been
found.
Jun 2, 2011 3:58:40 PM
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: WebApplicationException has been caught : no cause is available
Any ideas?
Thanks,
Brian
--
View this message in context: http://cxf.547215.n5.nabble.com/404-with-numeric-IPv6-address-in-URL-tp4449661p4449661.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: 404 with numeric IPv6 address in URL
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Brian
On Thu, Jun 9, 2011 at 10:34 PM, bks <bk...@yahoo.com> wrote:
> Sergey, I think you got it with your suggestion that Jetty might be the
> problem.
>
> We're currently on Jetty 7.1.5. I just tried upgraded to 7.4.2 and it
> worked. I backed CXF up to our original 2.3.1, and it still worked. So
> even the old CXF is ok, it was Jetty all along.
>
> Thanks very much for your help on this, and my apologies for the wild goose
> chase.
>
Great, thanks for the confirmation. It was interesting, I learnt from
my colleague JB how to
configure IPV6 loopback address on Ubuntu along the way :-)
Cheers, Sergey
> Regards,
> Brian
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/404-with-numeric-IPv6-address-in-URL-tp4449661p4474374.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
Application Integration Division of Talend
http://sberyozkin.blogspot.com
Re: 404 with numeric IPv6 address in URL
Posted by bks <bk...@yahoo.com>.
Sergey, I think you got it with your suggestion that Jetty might be the
problem.
We're currently on Jetty 7.1.5. I just tried upgraded to 7.4.2 and it
worked. I backed CXF up to our original 2.3.1, and it still worked. So
even the old CXF is ok, it was Jetty all along.
Thanks very much for your help on this, and my apologies for the wild goose
chase.
Regards,
Brian
--
View this message in context: http://cxf.547215.n5.nabble.com/404-with-numeric-IPv6-address-in-URL-tp4449661p4474374.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: 404 with numeric IPv6 address in URL
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Brian
On Thu, Jun 9, 2011 at 1:05 AM, bks <bk...@yahoo.com> wrote:
> Hi Sergey,
>
> Thanks for taking a look at this. I just tried a few things, and I'm not
> sure we're out of the woods on this one yet ...
>
> I tried 2.4.0 previously, and there are some other components in our system
> that were not compatible (I think some Spring bits), so I have to stick with
> the 2.3.x branch for now.
>
> So I just tried with 2.3.5-SNAPSHOT, and I still have the problem,
> http://[::1]/rws/mobile/devices does not work. However, looking at your
> most recent example, your URLs have an explicit port number. So I tried
> http://[::1]:80/rws/mobile/devices, and that WORKED. So I backed up to
> 2.3.1 (the version that we're currently working with), and
> http://[::1]:80/... ALSO WORKED!
>
> I'm starting to think that the problem lies somewhere in parsing off the
> port number. I bet there's some code in CXF that is looking for the last
> ':' character, and if it finds one, assumes that everything before it is the
> host part, and everything after is the port part. So in the case where an
> explicit port number is specified, it will work. This works in every case
> EXCEPT for the case where we have a IPv6 address with no explicit port; in
> that case it finds the last ':' , thinks there is a port specification, and
> then starts breaking things apart, and ends up with a broken IP adress and a
> bogus port number.
>
> Sorry I can't easily try with 2.4.x, but it looks like at least 2.3.1 ->
> 2.3.5-SNAPSHOT are behaving in this way.
>
> Are you able to try this with default port and leaving off the ":port"
> specification?
>
I started Eclipse as a root, and run the test using an embedded Jetty,
still works for me:
Server:
sf.setAddress("http://[::1]/");
...
INFO: Started SelectChannelConnector@[::1]:80 STARTING
Client uses:
String endpointAddress ="http://[::1]/bookstore/name-in-query"
BookStore root resource prints:
http://[::1]:80/bookstore/name-in-query
I don't actually think CXF does an explicit parsing.
Are you using Tomcat or Jetty or something else ? It could be the bug
in the underlying servlet container after all.
Can you download CXF 2.3.4 source and debug CXF ServletController, add
a breakpoint in ServletController.invoke as well as in
AbstractHttpDestination.setupMessage and see if [::1] leaks somehow in
the path info part, so may be indeed it ends up with something like
'1]/bookstore/name-in-query'...My theory is that the container wrongly
reports the path info
Thanks, Sergey
> Thanks,
> Brian
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/404-with-numeric-IPv6-address-in-URL-tp4449661p4471257.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
Application Integration Division of Talend
http://sberyozkin.blogspot.com
Re: 404 with numeric IPv6 address in URL
Posted by bks <bk...@yahoo.com>.
Hi Sergey,
Thanks for taking a look at this. I just tried a few things, and I'm not
sure we're out of the woods on this one yet ...
I tried 2.4.0 previously, and there are some other components in our system
that were not compatible (I think some Spring bits), so I have to stick with
the 2.3.x branch for now.
So I just tried with 2.3.5-SNAPSHOT, and I still have the problem,
http://[::1]/rws/mobile/devices does not work. However, looking at your
most recent example, your URLs have an explicit port number. So I tried
http://[::1]:80/rws/mobile/devices, and that WORKED. So I backed up to
2.3.1 (the version that we're currently working with), and
http://[::1]:80/... ALSO WORKED!
I'm starting to think that the problem lies somewhere in parsing off the
port number. I bet there's some code in CXF that is looking for the last
':' character, and if it finds one, assumes that everything before it is the
host part, and everything after is the port part. So in the case where an
explicit port number is specified, it will work. This works in every case
EXCEPT for the case where we have a IPv6 address with no explicit port; in
that case it finds the last ':' , thinks there is a port specification, and
then starts breaking things apart, and ends up with a broken IP adress and a
bogus port number.
Sorry I can't easily try with 2.4.x, but it looks like at least 2.3.1 ->
2.3.5-SNAPSHOT are behaving in this way.
Are you able to try this with default port and leaving off the ":port"
specification?
Thanks,
Brian
--
View this message in context: http://cxf.547215.n5.nabble.com/404-with-numeric-IPv6-address-in-URL-tp4449661p4471257.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: 404 with numeric IPv6 address in URL
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Brian
>>
>> By the way, I tried with just a single host this morning, using localhost
>> addresses:
>>
>> http://127.0.0.1/rws/mobile/devices
>>
>> for IPv4, and
>>
>> http://[::1]/rws/mobile/devices
>>
>> for IPv6. IPv4 worked, IPv6 failed. Hopefully that will make your
>> investigation a little easier -- it does not require setting up a IPv6
>> network, the problem can be reproduced on a single system with IPv6
>> configured.
>>
> Thanks, this is helpful; I'll try experimenting on my laptop.
> Just not sure at the moment when exactly I can get to it, as I now how
> few issues to look at, will try asap
>
It appears that it works fine with CXF 2.4.1(-SNAPSHOT) and thus
should also work OK with CXF 2.3.5.
I've done a quick test locally,
Server is started at "http://[::1]:8080/"
Root resource:
@Path("bookstore")
public class BookStore {
@Context
private UriInfo ui;
@Path("books/{id}")
public Book getBook(@PathParam("id") String id) {
System.out.println(ui.getAbsolutePath().toString());
}
}
proxy code:
URI uri = URI.create("http://[::1]:" + PORT + "/");
URL url = uri.toURL();
BookStore store = JAXRSClientFactory.create(url.toString(), BookStore.class);
Book book = store.getBook("123");
assertEquals(123L, book.getId());
which works and the above pritnln prints:
http://[::1]:9000/bookstore/books/123/
Something must've been fixed in 2.4.1, give it a try please when it's released
thanks, Sergey
>
>> Brian
>>
--
Sergey Beryozkin
Application Integration Division of Talend
http://sberyozkin.blogspot.com
Re: 404 with numeric IPv6 address in URL
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Brian
On Fri, Jun 3, 2011 at 4:14 PM, bks <bk...@yahoo.com> wrote:
> Hi Sergey,
>
> Thanks for your quick response. I tried 2.3.4 this morning, and I have the
> same failure, 404 returned to the client and the same log messages on the
> server.
>
> By the way, I tried with just a single host this morning, using localhost
> addresses:
>
> http://127.0.0.1/rws/mobile/devices
>
> for IPv4, and
>
> http://[::1]/rws/mobile/devices
>
> for IPv6. IPv4 worked, IPv6 failed. Hopefully that will make your
> investigation a little easier -- it does not require setting up a IPv6
> network, the problem can be reproduced on a single system with IPv6
> configured.
>
Thanks, this is helpful; I'll try experimenting on my laptop.
Just not sure at the moment when exactly I can get to it, as I now how
few issues to look at, will try asap
Cheers, Sergey
> Brian
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/404-with-numeric-IPv6-address-in-URL-tp4449661p4451534.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
Re: 404 with numeric IPv6 address in URL
Posted by bks <bk...@yahoo.com>.
Hi Sergey,
Thanks for your quick response. I tried 2.3.4 this morning, and I have the
same failure, 404 returned to the client and the same log messages on the
server.
By the way, I tried with just a single host this morning, using localhost
addresses:
http://127.0.0.1/rws/mobile/devices
for IPv4, and
http://[::1]/rws/mobile/devices
for IPv6. IPv4 worked, IPv6 failed. Hopefully that will make your
investigation a little easier -- it does not require setting up a IPv6
network, the problem can be reproduced on a single system with IPv6
configured.
Brian
--
View this message in context: http://cxf.547215.n5.nabble.com/404-with-numeric-IPv6-address-in-URL-tp4449661p4451534.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: 404 with numeric IPv6 address in URL
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Brian
http://\[fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0\]/rws/mobile/devices
is likely confusing CXF ServletController or JAX-RS code delaing with
finding a match , will need to be investigated,
can you please try CXF 2.3.4, there were some related changes before
I can get to looking into it ?
thanks, Sergey
On Fri, Jun 3, 2011 at 12:13 AM, bks <bk...@yahoo.com> wrote:
> CXF 2.3.1, Jetty 7.1.5
>
> Hello,
>
> We have an application using CXF for RESTful web services. It has been
> working correctly on a IPv4 network for a long time.
>
> I am trying to verify our application on IPv6. It works ok if I use a
> nameservice hostname (/etc/hosts, DNS, etc.) in the URL, but I get a 404 if
> I use the numeric IP address, using the convention of enclosing the IPv6
> address in brackets. Using verbose cURL, I see this when it works:
>
> [root@localhost local]# curl --verbose --basic --user xxxxx:xxxxxxxx --ipv6
> 'http://visionserver6/rws/mobile/devices'
> * About to connect() to visionserver6 port 80
> * Trying fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0... connected
> * Connected to visionserver6 (fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0) port 80
> * Server auth using Basic with user 'xxxxx'
>> GET /rws/mobile/devices HTTP/1.1
>> Authorization: Basic YWRtaW46cGFzc3dvcmQ=
>> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5
>> OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
>> Host: visionserver6
>> Accept: */*
>>
> < HTTP/1.1 200 OK
> < Content-Type: application/json
> < Date: Thu, 02 Jun 2011 22:01:27 GMT
> < Transfer-Encoding: chunked
> < Server: Jetty(7.x.y-SNAPSHOT)
>
> [ snip -- returned JSON body deleted ]
>
> * Connection #0 to host visionserver6 left intact
> * Closing connection #0
>
>
> and this when it fails:
>
> [root@localhost local]# curl --verbose --basic --user xxxxx:xxxxxxxx --ipv6
> 'http://\[fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0\]/rws/mobile/devices'
> * About to connect() to fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0 port 80
> * Trying fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0... connected
> * Connected to fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0
> (fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0) port 80
> * Server auth using Basic with user 'xxxxx'
>> GET /rws/mobile/devices HTTP/1.1
>> Authorization: Basic YWRtaW46cGFzc3dvcmQ=
>> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5
>> OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
>> Host: [fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0]
>> Accept: */*
>>
> < HTTP/1.1 404 Not Found
> < Content-Type: text/xml
> < Date: Thu, 02 Jun 2011 21:58:40 GMT
> < Content-Length: 0
> < Server: Jetty(7.x.y-SNAPSHOT)
> * Connection #0 to host fd4f:6e92:48ef:1:20c:29ff:fe9a:4b0 left intact
> * Closing connection #0
>
>
> It looks like connection to the web server is succeeding, and the GET
> command is the same in both cases. The only thing obviously different in
> the request is the value of the Host header, and I believe that is correct
> per RFC 2732.
>
> I turned on CXF debug logging. In the successful case, nothing is logged;
> when it fails, I get this:
>
> Jun 2, 2011 3:58:39 PM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor
> processRequest
> WARNING: No root resource matching request path /rws/mobile/devices has been
> found.
> Jun 2, 2011 3:58:40 PM
> org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
> WARNING: WebApplicationException has been caught : no cause is available
>
>
> Any ideas?
>
> Thanks,
> Brian
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/404-with-numeric-IPv6-address-in-URL-tp4449661p4449661.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
Application Integration Division of Talend
http://sberyozkin.blogspot.com