REST中的MIMEParsingException

won*_*nce 3 java rest netbeans6.8

我有一个关于MIMEParsingException的问题.我将Java EE 6与NetBeans 6.8一起使用.我用Java编写了一个简单的REST Web服务来打印"hello world",它运行良好.然后我编写一个REST Web服务客户端(Java Main Class)来测试REST:

公共类HelloWorldClient {

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
    ClientConfig config = new DefaultClientConfig();
    Client client = Client.create(config);
    WebResource service = client.resource(getBaseURI());
    String xml = service.path("resources").path("helloworld").accept(MediaType.TEXT_XML).get(String.class);
    System.out.println(xml);
}

private static URI getBaseURI() {
    return UriBuilder.fromUri("http://localhost:8080/HelloWorldApplication").build();
}
Run Code Online (Sandbox Code Playgroud)

}

它符合顺序没有错误,但是当我运行它时,它会在此行抛出MIMEParsingException:Client client = Client.create(config);

线程"main"中的异常com.sun.jersey.spi.service.ServiceConfigurationError:jersey-client-components:类com.sun.jersey.multipart.impl.MultiPartReader的依赖类org/jvnet/mimepull/MIMEParsingException找不到实现提供程序类java.lang.Object.提供程序实现被忽略.在com.sun.jersey.spi.service.ServiceFinder.fail(ServiceFinder.java:388)的com.sun.jersey.spcess.service.ServiceFinder.access $ 200(ServiceFinder.java:144)com.sun.jersey. spi.service.ServiceFinder $ LazyClassIterator.next(ServiceFinder.java:595)位于com.sun.jersey.spi.service的com.sun.jersey.spi.service.ServiceFinder $ LazyClassIterator.next(ServiceFinder.java:571). Com.sun.jersey.api.client.Client上的ServiceFinder.toClassArray(ServiceFinder.java:374).(Client.java:

谁能解决这个问题?非常感谢.

Kev*_*vin 5

你错过了一个依赖:

非专业开发人员要求:

mimepull.jar, jersey-multipart.jar