How should I mock Jersey HTTP-client requests? - java

This is the class I'm trying to test (it calculates the size of HTTP page):
import javax.ws.rs.core.MediaType;
import com.sun.jersey.api.client.*;
public class Loader {
private Client client;
public Loader(Client c) {
this.client = c;
}
public Integer getLength(URI uri) throws Exception {
return c.resource(uri) // returns WebResource
.accept(MediaType.APPLICATION_XML) // returns WebResource.Builder
.get(String.class) // returns String
.length();
}
}
Of course it just an example, not a real-life solution. Now I'm trying to test this class:
public class LoaderTest {
#Test public void shouldCalculateLength() throws Exception {
String mockPage = "test page"; // length is 9
Client mockedClient = /* ??? */;
Loader mockedLoader = new Loader(mockedClient);
assertEquals(
mockPage.length(),
mockedLoader.getLength(new URI("http://example.com"))
);
}
}
How should I mock com.sun.jersey.api.client.Client class? I'm trying to use Mockito, but any other framework will be OK, since I'm a newbie here..

Not really related to your question, but may come in handy later, is the Jersey Test Framework. Check out these blog entries by one of the Jersey contributors;
http://blogs.oracle.com/naresh/entry/jersey_test_framework_makes_it
http://blogs.oracle.com/naresh/entry/jersey_test_framework_re_visited
Back on topic, to test your Loader class you can simply instantiate it with a Client obtained from Client.create(). If you are using Maven you can create a dummy test endpoint (in src/test/java) to call and the Jersey Test framework will load it in Jetty.

You example is really complex, i wasnt able to run it with newest version of jersey, so i created those classes and here is how i mock it with EasyMock.
String mockPage = "test page"; // length is 9
RequestBuilder requestBuilderMock = createNiceControl().createMock(RequestBuilder.class);
expect(requestBuilderMock.get((Class < String >) anyObject())).andReturn("12345678").anyTimes();
replay(requestBuilderMock);
WebResource webResourcemock = createNiceControl().createMock(WebResource.class);
expect(webResourcemock.accept((String[]) anyObject())).andReturn(requestBuilderMock).anyTimes();
replay(webResourcemock);
Client clientMock = createNiceControl().createMock(Client.class);
expect(clientMock.resource((URI) anyObject())).andReturn(webResourcemock).anyTimes();
replay(clientMock);
Loader mockedLoader = new Loader(clientMock);
assertEquals((Integer) mockPage.length(), mockedLoader.getLength(new URI("http://example.com")));
If any of classes that you are trying to mock doesnt have default constructor then you should use
http://easymock.org/api/easymock/3.0/org/easymock/IMockBuilder.html#withConstructor%28java.lang.Class...%29

Related

JUnit 5 test for Soap Web Service - ParameterResolutionException: No ParameterResolver registered

Am trying to create a JUnit 5 test for a published .NET Soap Web Service using Java 1.8.
Currently, I am following a pattern from a WebServiceClient in the codebase which contains a main() method.
WebServiceClient.java:
import static com.google.common.base.Preconditions.checkNotNull;
public class WebServiceClient {
IPersonWebService service;
public WebServiceClient(IPersonWebService service) {
this.service = checkNotNull(service);
}
private PersonData getPersonData() throws Exception {
return service.getPersons(null);
}
public static void main(String [] args) {
IPersonWebService service = new IPersonWebServiceImpl().getBasicHttpBindingIPersonWebServiceImpl();
WebServiceClient client = new WebServiceClient(service);
PersonData personData = client.getPersonData();
System.out.println(personData.toString());
}
}
Need to following the same type of functionality in:
WebServiceTest.java:
import org.junit.Before;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static com.google.common.base.Preconditions.checkNotNull;
public class WebServiceTest {
IPersonWebService service;
public WebServiceTest(IPersonWebService service) {
this.service = checkNotNull(service);
}
#Before
public void before(IPersonWebService service) {
this.service = checkNotNull(service);
}
#Test
public void testGetPersonData() throws Exception {
IPersonWebService service =
new IPersonWebServiceImpl().getBasicHttpBindingIPersonWebServiceImpl();
WebServiceTest client = new WebServiceTest(service);
PersonData personData = client.getPersonData();
assertThat(personData).isNotNull();
}
private PersonData getPersonData() throws Exception {
return service.getPersonData(null);
}
}
Running this within IntelliJ IDEA results in:
org.junit.jupiter.api.extension.ParameterResolutionException: No ParameterResolver registered for parameter [com.myapp.IPersonWebService arg0] in constructor [public com.myapp.WebServiceTest(com.myapp.IPersonWebService)].
at java.util.Optional.orElseGet(Optional.java:267)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at java.util.ArrayList.forEach(ArrayList.java:1249)
IPersonWebService.java:
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*
*/
#WebService(name = "IPersonWebService", targetNamespace = "http://sample.org/")
#XmlSeeAlso({
ObjectFactory.class
})
public interface IPersonWebService {
#WebMethod(operationName = "GetPersonData",
action = "http://sample.org/IPersonWebService/GetPersonData")
#WebResult(name = "GetVehiclesResult",
targetNamespace = "http://sample.org/")
#RequestWrapper(localName = "GetPersonData",
targetNamespace = "http://sample.org/",
className = "com.myapp.GetPersonData")
#ResponseWrapper(localName = "GetPersonDataResponse",
targetNamespace = "http://sample.org/",
className = "com.myapp.GetPersonDataResponse")
public {PersonData} getPersonData(
#WebParam(name = "applicationID",
targetNamespace = "http://sample.org/")
String applicationID)
throws IPersonWebServicetExceptionFaultMessage;
}
This contains the actual WSDL that will be imported into memory.
IPersonWebServiceImpl.java:
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*
*/
#WebServiceClient(name = "IPersonWebServiceImpl",
targetNamespace = "http://sample.org/",
wsdlLocation = "https://sample.com/WCF/IPersonWebServiceImpl.svc?singleWsdl")
public class IPersonWebServiceImpl
extends Service
{
private final static URL IPersonWebServiceImpl_WSDL_LOCATION;
private final static WebServiceException IPersonWebServiceImpl_EXCEPTION;
private final static QName IPersonWebServiceImpl_QNAME = new QName("http://sample.org/", "IPersonWebServiceImpl");
static {
URL url = null;
WebServiceException e = null;
try {
url = new URL("https://sample.com/WCF/IPersonWebServiceImpl.svc?singleWsdl");
} catch (MalformedURLException ex) {
e = new WebServiceException(ex);
}
IPersonWebServiceImpl_WSDL_LOCATION = url;
IPersonWebServiceImpl_EXCEPTION = e;
}
public IPersonWebServiceImpl() {
super(__getWsdlLocation(), IPersonWebServiceImpl_QNAME);
}
public IPersonWebServiceImpl(final WebServiceFeature... features) {
super(__getWsdlLocation(), IPersonWebServiceImpl_QNAME, features);
}
public IPersonWebServiceImpl(final URL wsdlLocation) {
super(wsdlLocation, IPersonWebServiceImpl_QNAME);
}
public IPersonWebServiceImpl(final URL wsdlLocation,
final WebServiceFeature... features) {
super(wsdlLocation, IPersonWebServiceImpl_QNAME, features);
}
public IPersonWebServiceImpl(final URL wsdlLocation,
final QName serviceName) {
super(wsdlLocation, serviceName);
}
public IPersonWebServiceImpl(final URL wsdlLocation,
final QName serviceName,
final WebServiceFeature... features) {
super(wsdlLocation, serviceName, features);
}
#WebEndpoint(name = "BasicHttpBinding_IPersonWebServiceImpl")
public IPersonWebServiceImpl getBasicHttpBindingIPersonWebServiceImpl() {
return super.getPort(new QName("http://sample.org/",
"BasicHttpBinding_IPersonWebServiceImpl"),
IPersonWebServiceImpl.class);
}
#WebEndpoint(name = "BasicHttpBinding_IPersonWebServiceImpl")
public IPersonWebServiceImpl getBasicHttpBindingIPersonWebServiceImpl(final WebServiceFeature... features) {
return super.getPort(new QName("http://sample.org/",
"BasicHttpBinding_IPersonWebServiceImpl"),
IPersonWebServiceImpl.class, features);
}
private static URL __getWsdlLocation() {
if (IPersonWebServiceImpl_EXCEPTION!= null) {
throw IPersonWebServiceImpl_EXCEPTION;
}
return IPersonWebServiceImpl_WSDL_LOCATION;
}
}
Question(s):
When trying to follow along using the pattern inside WebServiceClient.java, why does WebServiceTest.java fail with this:
org.junit.jupiter.api.extension.ParameterResolutionException:
No ParameterResolver registered for parameter...
How to resolve this?
The WebServiceClient.java works and shows PersonData which was obtained from the IPersonWebServiceImpl.java (notice how this has the WSDL explicitly setup inside the static clause).
Is there a 3rd party open source Java framework which I can use to import any type of WSDL (.NET or others) and test SOAP based endpoints using JUnit 5?
Come from a RESTful Web Services background and not a SOAP based background, so any suggestions would be most appreciated.
So firstly, thanks for providing loads of code and making your question clear. I see it's been a few months since you asked, but I'll try and help.
I think there's two problems: the exception (tldr it's a junit version clash), and structuring code for writing unit tests.
ParameterResolutionException
#Test is imported from JUnit5, aka 'junit-jupiter', but #Before is from JUnit4, aka 'junit-vintage' or 'junit'.
import org.junit.Before; // junit4
import org.junit.jupiter.api.BeforeAll; // junit5
import org.junit.jupiter.api.Test; // junit5
Because the #Test is from junit-jupiter, the tests are run with JUnit5, which (unlike JUnit4) allows for parameters in test and constructors methods. WebServiceTest's constructor needs a parameter. But you don't have a provider for IPersonWebService, so JUnit5 breaks - it can't resolve it.
So to fix this:
remove the constructor
remove the parameter from the before method
change #Before to #BeforeEach (and fix the imports)
I'd also recommend (if possible) that you exclude any JUnit4 dependencies that you might have added (junit-vintage is for backwards compatibility), or might have been snuck in from other dependencies. It prevents confusions like this.
For example with maven, to see which JUnit versions there are, and their origins, view and filter the dependency tree:
mvn dependency:tree -Dincludes="*junit*"
Writing unit tests
I'm not sure what the application is intended to be, but (as I think you've found out) it's difficult to test. It certainly looks strange to me. WebServiceClient has a main method (I guess it gets called directly?) that immediately creates the API and calls it and returns the result - so there's no separation between the 'business logic' and 'api'. Maybe that main method is there for demonstrating?
It would be best to split things up. Hopefully then it makes testing more clear.
Let's make a dedicated WebServiceClient. This should be the only class that interacts with IPersonWebService.
There shouldn't be any sort of fancy logic in here, just simple API calls with basic exception handling.
// import generated soap stuff
public class WebServiceClient {
private final IPersonWebService service;
public WebServiceClient(IPersonWebService service) {
// an instance of the API is received in the constructor
this.service = service;
}
private PersonsData getPersonData() throws WebServiceClientException {
try {
// call the API
PersonsData persons = service.getPersonData(null);
if (personsData == null) {
throw new WebServiceClientException("Received null response from PersonsData :(");
}
return persons;
} catch (IPersonWebServicetExceptionFaultMessage e) {
// wrap the SOAP exception in our own wrapper
// it's best not to let SOAP code spread into our project.
throw new WebServiceClientException("Tried fetching PersonsData, but got exception from API", e);
}
}
}
And here's the test class for that service.
Each #Test method is completely independent from the others, it has its own little bubble to keep the tests independent.
I really recommend using a mocking framework, like Mockito, to create dummy instances. It's really powerful. In this case it means we can easily test exceptions. Mockito 3 works really well with JUnit5 - I've used the parameter injection here to make mocks for the tests (Mockito provides a Parameter Resolver under the hood).
#ExtendWith(MockitoExtension.class)
class WebServiceClientTest {
#Test
public void testWebServiceClientCreated(
// it's not actually important about the internal workings of IPersonWebService
// so use mockito to mock it!
// all we care about is that if it's there, then WebServiceClient can be created
#Mock
IPersonWebService service) {
WebServiceClient wsc = new WebServiceClient(service);
assertNotNull(wsc);
}
// test happy flow
#Test
public void testPersonsDataReturned(
// again, we don't care about the internals of IPersonWebService, just that it returns data
// so mock it!
#Mock
IPersonWebService service,
// it's also not important about the internals of PersonsData,
// just that it's an object that's returned
#Mock
PersonsData personsDataMock) {
// set up the mock
when(service.getPersonsData(isNull())).thenReturn(personsDataMock);
WebServiceClient wsc = new WebServiceClient(service);
// we don't need to check WebServiceClient here! We already have a test that does this.
// each test should only focus on one thing
// assertNotNull(wsc);
PersonsData result = wsc.getPersonsData();
// now we can check the result
assertNotNull(result);
assertEquals(personsDataMock, result);
}
// again, testing for failure is much more interesting than happy flows
// in this case, the test will fail!
// we'd better fix WebServiceClient to handle unexpected exceptions from IPersonWebService
#Test
public void testWhenApiThrowsNullPointerExceptionExpectWebServiceClientException(
#Mock
IPersonWebService service) {
// mock throwing an exception
NullPointerException npe = new NullPointerException("Another one of those weird external webservice exceptions");
doThrow()
.when(service.getPersonsData(isNull()));
WebServiceClient wsc = new WebServiceClient(service);
WebServiceClientException thrownException = assertThrows(WebServiceClientException.class,
() -> wsc.getPersonsData()
);
// now we can check the result
assertNotNull(thrownException);
assertEquals("Tried fetching PersonsData, but got exception from API", thrownException.getMessage());
assertEquals(npe, thrownException.getCause());
}
}
And a nice wrapper for any exceptions when dealing with the API.
class WebServiceClientException extends Exception {
public WebServiceClientException(String message) {
super(message);
}
public WebServiceClientException(String message, Exception cause) {
super(message, cause);
}
}

How to test a call to external api in Spring Boot

I have a method in the service class that uses an external wrapper to call the slack api. The wrapper I'm using is this one if it makes any difference. This is how I'm using the wrapper,
//This is the method in my service class
public String sendMess(SlackObj obj) {
//SlackObj contains the channel url, channel name and the message
//build the payload from the SlackObj
//Slack is the name of the wrapper's class that I'm using
Slack slack = Slack.getInstance();
//slack.send is the method that sends the message to slack
WebhookResponse res = slack.send(url, payload);
//other logic
}
//This is what I've tried
#Test
public void slackSendMessageTest(){
//build the slack obj and payload
//build the mock WebhookResponse
Slack slackMock = mock(Slack.class)
when(slackMock.send(channelUrl, payload)).thenReturn(mockWebHookRes);
assertEquals("SUCCESS", testService.sendMessage(testSlackObj);
}
I am trying to write some tests for this method, so my question is, how would i test it without having the message sent every time I run the test? I believe the cause of this is because slack itself is not mocked and I have no idea as how to inject the mock into the mocked service class.
I am open to refactoring the service class if it helps with the testing. Any suggestions and recommendation is appreciated. Thanks.
You are going to have to find a way to mock Slack, which appears to be a singleton, unfortunately.
Here's what I would do:
1) Make Slack available as a bean that can be autowired:
#Configuration
public class SlackConfiguration {
#Bean
public Slack slack() {
return Slack.getInstance();
}
}
2) Change your class to take an injected Slack:
Note that I am totally guessing on the name here, as you just show the method. You would inject the Slack object you turned into a #Bean above, and not use Slack.getInstance() directly anywhere else.
#Component
public class SlackService {
private final Slack slack;
#Autowired
public SlackService(final Slack slack) {
this.slack = slack;
}
public String sendMessage(final Object message) {
final WebhookResponse res = slack.send(url, payload);
// etc
}
}
3) Mock the Slack object and pass it to your SlackService in test:
This allows you to mock out the implementation of Slack, so you can alter its behavior. I won't go into mocking in detail.
public class SlacServiceTest {
private final Slack slack = mock(Slack.class);
private final SlackService serviceUnderTest = new SlackService(slack);
#Test
public void testSomething() {
// TODO: set mock responses here
// Given... when... then...
}
}

Mockito for REST + DAO objects

This is my mock code for testing end to end:
#RunWith(MockitoJUnitRunner.class)
public class testRest extends Jersey Test{
DAOFactory mockDAOfactory;
RPRestrictionReasonDAO fakeDao;
#Before
public void init() {
mockDAOfactory = mock(DAOFactory.class);
fakeDao = mock(RPRestrictionReasonDAO.class);
}
#Test
public void testServiceWorks() throws Exception {
//Assuming I hav already initialized restrictReasons with a dummy value
when(fakeDao.findAll()).thenReturn(restrictReasons);
when(mockDAOfactory.getRPRestrictionReasonDAO()).thenReturn(fakeDao);
String response = client().resource("http://localhost:9998/")
.path("EmployerDetails/PossibleRestrictions")
.get(String.class);
System.out.println("Response is " + response.toString());
}
}
Whenever I do this, I always get the ACTUAL results in my DB rather than the restrictReasons. I've tried all blogs but nothing seems to help. How I get around this? lemme know If I need to post more code.
Note: I have implemented the methods while extending Jersey Test with Grizzly container.
From what I can tell from your code, you are creating the mocks but not actually using the mocks in your client / server implementation.
For a mock to work, it needs to be used by the underlying implementation, not just created in your test class. In this case, assuming your test is running in the same JVM as the server you are testing against, you need to inject your created mocks into the classes that rely on them.
The other answer by #inkalimeva is attempting to address this issue for you by injecting the mocks into your DAO factory. You may be able to fix the error you are experiencing with that answer by changing the DAOFactory declaration to be the concrete class used instead of the abstract one.
E.g.
#InjectMocks
DAOFactoryImpl mockFactory;
Assuming DAOFactoryImpl is your concrete factory class.
Try this, with injecion of mocks using annotations.
#RunWith(MockitoJUnitRunner.class)
public class testRest extends Jersey Test {
#InjectMocks
DAOFactory mockDAOfactory;
#Mock
RPRestrictionReasonDAO fakeDao;
#Before
public void init()
//Do nothing
//mockDAOfactory = mock(DAOFactory.class);
//fakeDao = mock(RPRestrictionReasonDAO.class);
}
#Test
public void testServiceWorks() throws Exception {
//Assuming I hav already initialized restrictReasons with a dummy value
when(fakeDao.findAll()).thenReturn(restrictReasons);
when(mockDAOfactory.getRPRestrictionReasonDAO()).thenReturn(fakeDao);
String response = client().resource("http://localhost:9998/")
.path("EmployerDetails/PossibleRestrictions")
.get(String.class);
System.out.println("Response is " + response.toString());
}
}

How to use Mockito to test SOAP messages?

I'm fairly new to Mockito, and figured I would try to use it to test a SOAP Handler. However, this is turning out to be a much more painful than I would have expected/desired.
I'm looking to validate that my handler is able to extract the messageID in the header of a SOAPMessage. However, from the handler, the only way to get to the header is via the context/message/part/envelope/header. Using Mockito my solution was to mock my SOAPMessage, meant creating each individual object, and stubbing the method.
I can only imagine that there is an easier/cleaner way of accomplishing this:
#RunWith(MockitoJUnitRunner.class)
public class UUIDHandlerTest {
#Mock private SOAPMessage message;
#Mock private SOAPEnvelope envelope;
#Mock private SOAPHeader header;
#Mock private SOAPPart part;
#Mock
private SOAPMessageContext context;
#Before
public void setup() throws SOAPException{
when( context.getMessage()).thenReturn(message);
when( message.getSOAPPart()).thenReturn(part);
when( part.getEnvelope()).thenReturn(envelope);
when( envelope.getHeader()).thenReturn(header);
}
#Test
public void testHandleInboundMessage() {
when( context.get(SOAPMessageContext.MESSAGE_OUTBOUND_PROPERTY)).thenReturn(false);
when(header.getElementsByTagName(anyString())).thenAnswer(new Answer<NodeList>() {
/* (non-Javadoc)
* #see org.mockito.stubbing.Answer#answer(org.mockito.invocation.InvocationOnMock)
*/
#Override
public NodeList answer(InvocationOnMock invocation) throws Throwable {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new ByteArrayInputStream(new String("<wsa:MessageID>messageId</wsa:MessageID>").getBytes()));
// TODO Auto-generated method stub
return doc.getElementsByTagName("wsa:MessageID");
}
});
// call the test class
new UUIDHandler().handleMessage(context);
// check the MDC value
assertEquals("messageId", MDC.get(LoggerConstants.DC_PROPERTY_MESSAGE_ID));
}
}
Like I said, it works, but it looks like a very ugly/heavy weight solution.
Is there anyway to do this easier/cleaner?
Thanks!
Eric
SOAPMessageContext context =
mock(SOAPMessageContext.class, RETURNS_DEEP_STUBS);
when(context.getMessage().getSOAPPart().getEnvelope().
getHeader().getElementsByTagName(anyString())).
then(...);
Please also pay attention to the notes on using deep stubs in the mockito documentation.
http://docs.mockito.googlecode.com/hg/org/mockito/Mockito.html#RETURNS_DEEP_STUBS
Annotation style:
#Mock(answer = Answers.RETURNS_DEEP_STUBS) SOAPMessageContext context;
A bit late here, but I prefer spawning a working Endpoint which proxies a mockito mock. This lets me test the whole stack, including interceptors and/or handlers, which should be helpful for your use-case.
I've put up a simple JUnit Rule which simplifies things somewhat here. The resulting test-cases should be small and clean. I recommend loading test XML responses directly from XML files, because that is faster and more simple to maintain.
Don't mock things like this.
Listen to the code... its telling you that this is not the right way to do it.
Rather, just create a (real) message that has some known data in it, and assert that your code does the right stuff with it.
e.g.
MessageIdExtractor extractor = new MessageIdExtractor(); // <- class you are testing
String expectedMessageId = "xxxxxx";
Message m = new SOAPMessage( ).setMessageId(expectedMessageId);
assertThat(extractor.extractIdFrom(m), equalTo(expectedMessageId));

MIMEParsingException in 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 :
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();
}
}
It complies without error, but when I run it, it throws MIMEParsingException at this line :
Client client = Client.create(config);
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.
You're missing a dependency:
Non-maven developers require:
mimepull.jar,
jersey-multipart.jar

Categories