Eclipse tomcat java service HTTP error 404

I try to keep up with the java service. So I found several tutorials that explain always the same way. But I cannot run this: (.

I did Dynamic Web Project in Version 2.5 and Tomcat 7.0 in eclipse. Then I load the following jars into WEB-INF / lib

enter image description here

My project name is com.freespots.rest. I created the following web.xml

enter image description here

Ok, now am I going to create permissions for the Java class? Well, I did this Java Resources / src / com.freespots.rest.service:

enter image description here

If I start Tomcat and type the url for my browser like localhost: 8080 / com.freespots.rest, Tomcat shows my index.html file. But if I go to url localhost: 8080 / com.freespots.rest / api / hello there is only HTTP 404 error: enter image description here

Good thing I am new to Java Webdevelopment and I cannot figure out my problem. Hope some guy can explain my mistake. Thanks in advance.

+3


source to share


2 answers


You are using the old (1.x) Jersey configuration. In Jersey 2.x, the class names and property names have changed. Instead, you should use

<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
    <param-name>jersey.config.server.provider.packages</param-name>
    ...

      



More deployment options here

+3


source


localhost: 8080 / com.freespots.rest This url will run the welcome page which is index.html as you said and no 404 no error found pages found here. Try to set the method and call localhost:8080/com.freespots.rest/api/hello

@Path("name")

localhost:8080/com.freespots.rest/api/hello/name



0


source







All Articles