简体   繁体   中英

Restful web service in eclipse

I am using Restful web service in eclipse. Few days ago it is running smoothly. But today, something goes wrong. Web services are running properly but when I modified something on web service program it does not reflect after invoking the web service. I have noticed earlier that whenever I changed small code in my program the server starts automatically and it reflects on the fly. Now my web service starts but seems like it runs from cache. Whatever I modified in the program it does not show in output. I have restart (stop & start) the server and even restart the eclipse but nothing changes. It gives always previous results. for example

@Path("/todo")
public class TodoResource {
  // This method is called if XMLis request
 @GET
//@Path("/text")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Todo getXML() {
Todo todo = new Todo();
todo.setSummary("testing web service");
todo.setDescription("This is my first todo using restful");
return todo;
}

when I run this web service, it gives output as

testing web service
This is my first todo using restful

When I modified somthing like (just segement of code 4444 is added) todo.setSummary("testing web service 4444");

it does not display 4444, instead it show older output testing web service This is my first todo using restful

Its really strange and I do not know what goes wrong. Any helps or suggestions are appreciated.

Eclipse Version: Indigo Service Release 2

Thanks in advance

Shrestha

  • Stop the Tomcat server from Eclipse (via the Servers view)
  • Check to make sure you have no compile errors in your code
  • Right click on the Tomcat server in Eclipse and select the menu item Clean...
  • Start the Tomcat server again from Eclipse

I had the same issue; managed to resolved it by cleaning the project:

Project > Clean ...

Stopping, starting/cleaning the server didn't do a thing for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM