CXF を使用してレスト クライアントを作成したいと考えています。次のコードは例外をスローします
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(Blogger.class);
sf.getInInterceptors().add(new LoggingInInterceptor());
sf.getOutInterceptors().add(new LoggingOutInterceptor());
sf.setAddress("http://myservice");
Map<Object, Object> mappings = new HashMap<Object, Object>();
mappings.put("xml", "application/xml");
mappings.put("json", "application/json");
sf.setExtensionMappings(mappings);
sf.create();
私が得た例外は
Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/WebApplicationException
at com.test.LoggingTest.main(LoggingTest.java:26)
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.WebApplicationException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 1 more