[Jersey] resolveTemplate Problem

From: Todd Donahue <>
Date: Tue, 27 Aug 2013 21:31:26 -0700

I am trying to use the following code to make a client request in my server and it fails with an IllegalArgumentException, Host name may not be null.

WebTarget target ="https://{host}/{version}/tokens/proxy");

target.resolveTemplate("host", "").resolveTemplate("version", "v2");

response = target.request(MediaType.APPLICATION_JSON)


.header(HttpHeaders.AUTHORIZATION, accessToken)


If I use UriBuilder to build the Uri and then create a WebTarget from that: WebTarget target =, that works correctly.

I am using Jersey 2.2. Any suggestions?

Todd Donahue