REST中的MIMEParsingException [英] MIMEParsingException in REST
问题描述
我对MIMEParsingException有疑问. 我将Java EE 6与NetBeans 6.8一起使用.我用Java编写了一个简单的REST Web服务以打印"hello world",它运行良好. 然后,我编写一个REST Web服务客户端(Java Main Class)来测试REST:
I have a question about MIMEParsingException. I use Java EE 6 with NetBeans 6.8. I write a simple REST web service in Java to print "hello world", it runs well. Then I write a REST web services client (Java Main Class) to test REST :
公共类HelloWorldClient {
public class 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();
}
}
它符合要求,没有错误,但是当我运行它时,它在此行抛出MIMEParsingException: 客户端客户端= Client.create(config);
It complies without error, but when I run it, it throws MIMEParsingException at this line : Client client = Client.create(config);
线程"main" com.sun.jersey.spi.service.ServiceConfiguration中的异常:jersey-client-components:com.sun.jersey.multipart类的从属类org/jvnet/mimepull/MIMEParsingException.找不到实现提供程序类java.lang.Object的impl.MultiPartReader.提供程序实现将被忽略. 在com.sun.jersey.spi.service.ServiceFinder.fail(ServiceFinder.java:388) 在com.sun.jersey.spi.service.ServiceFinder.access $ 200(ServiceFinder.java:144) 在com.sun.jersey.spi.service.ServiceFinder $ LazyClassIterator.next(ServiceFinder.java:595) 在com.sun.jersey.spi.service.ServiceFinder $ LazyClassIterator.next(ServiceFinder.java:571) 在com.sun.jersey.spi.service.ServiceFinder.toClassArray(ServiceFinder.java:374) 在com.sun.jersey.api.client.Client.(Client.java:167) 在com.sun.jersey.api.client.Client.(Client.java:139) 在com.sun.jersey.api.client.Client.create(Client.java:466) 在helloWorld.client.HelloWorldClient.main(HelloWorldClient.java:29)
Exception in thread "main" com.sun.jersey.spi.service.ServiceConfigurationError: jersey-client-components: A dependent class, org/jvnet/mimepull/MIMEParsingException, of the class com.sun.jersey.multipart.impl.MultiPartReader implementing the provider class java.lang.Object is not found. The provider implementation is ignored. at com.sun.jersey.spi.service.ServiceFinder.fail(ServiceFinder.java:388) at com.sun.jersey.spi.service.ServiceFinder.access$200(ServiceFinder.java:144) at com.sun.jersey.spi.service.ServiceFinder$LazyClassIterator.next(ServiceFinder.java:595) at com.sun.jersey.spi.service.ServiceFinder$LazyClassIterator.next(ServiceFinder.java:571) at com.sun.jersey.spi.service.ServiceFinder.toClassArray(ServiceFinder.java:374) at com.sun.jersey.api.client.Client.(Client.java:167) at com.sun.jersey.api.client.Client.(Client.java:139) at com.sun.jersey.api.client.Client.create(Client.java:466) at helloWorld.client.HelloWorldClient.main(HelloWorldClient.java:29)
谁可以解决此问题?非常感谢.
Who can resolve this problem ? Thanks a lot.
推荐答案
您丢失了
非Maven开发人员需要:
Non-maven developers require: mimepull.jar ,
jersey-multipart.jar 这篇关于REST中的MIMEParsingException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!