We have an application that uses the modern JAX-RS implementations to call a REST service. However, this was deployed to a WAS-7 which uses J2EE-5 under the hood. The code looks like this
Client client = new Client();
Builder request = client.target("http:\\abc.com").path("path\to\endpoint")
.property("propA", securityType)
.request().accept(MediaType.APPLICATION_JSON);
This implementation works flawlessly in WAS8 (with J2EE6). Due to architectural concerns we can't migrate to a WAS8 just yet. When this code is run on WAS7, I get the following exception:
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.UriBuilder
at java.net.URLClassLoader.findClass(URLClassLoader.java:432)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:201)
I've done a lot of research to find a good and simple example of a REST Client implementation in J2EE-5 , but have had no luck. Any help would be appreciated.
This is not hard as you think.
if you compare J2EE5 and J2EE6.
|Java EE 5 (JSR-244) |Java EE 6 (JSR-316)
|nothing for JAX-RS |new! JAX-RS 1.1 JSR 311
you can refer to here for more difference.
That is to say, you only add JAX-RS releated jar to your application. Then you will be fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.