Hi,
thank you in advance for your help on this issue.
I am using Eclipse and would like to avoid Maven. (Team decision)
*I have a simple resource file that returning a String on a GET call:*
package org.genomespace.datamanager.resource
@Path("/datamanager")
public class DataManagerResource {
@Context
private UriInfo context;
/** Creates a new instance of datamanagerResource */
public DataManagerResource() {
}
@GET
@Path("download")
@Produces(MediaType.TEXT_PLAIN)
public String getDownloadSignedUrl() {
try {
return "Message from download";
} catch (Exception ex) {
throw new WebApplicationException(ex);
}
}
*Now I try to run my Jersey test using the run As-> JUnit under Eclipse*
public class DataManagerTest extends JerseyTest{
public DataManagerTest() {
super(new
WebAppDescriptor.Builder("org.genomespace.datamanager.resource")
.contextPath("datamanager").build());
}
@Test
public void DownloadFromClient() throws Exception{
WebResource webResource = resource();
String url = webResource.path("download").get(String.class);
assertNotNull(url);
assertTrue(!url.isEmpty());
}
}
*And I get this Error:*
com.sun.jersey.api.client.UniformInterfaceException: _GET
http://localhost:9998/datamanager/download?username=yvigneau&token=yvigneau&path=test/fileName.txt
returned a response status of 404_
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:562)
at
com.sun.jersey.api.client.WebResource.access$200(WebResource.java:69)
at
com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:451)
at
org.genomespace.datamanager.DataManagerTest.DownloadFromClient(DataManagerTest.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
*When I run a Grizzlyserver from inside Eclipse using a Main and then
start a client from another Main(process) calling the same service, It
works.
Here is ALL the jar files I gathered from Maven2 jersey project and
imported into my project.* (see attachment Issue404.bmp)
Again, thank you in advance for your assistance.
Best Regards,
Yan