简体   繁体   中英

How to kill javaw.exe

I am learning Spring MVC using Maven project and I facing a problem. This is my controller:

@Controller
public class HelloWorldController {

    @RequestMapping("/hello")
    public String hello(Model model) {
        model.addAttribute("greeting", "Hello Spring MVC");
        return "helloworld";
    }
}

I run my project by this way (I am using Eclip Neon): Right click on project > Run as > Run configurations > Right click on Maven Build > New > Enter name, base directory and goals > Apply > Run. Done.

When I access this url

http://localhost:8080/DemoSpringMVC/hello

the "helloworld" page will be displayed, this is simple.

Now I want to change @RequestMapping("/hello") to @RequestMapping("/hello1") , like this

@Controller
public class HelloWorldController {

    @RequestMapping("/hello1")
    public String hello(Model model) {
        model.addAttribute("greeting", "Hello Spring MVC");
        return "helloworld";
    }
}

I run my project again, access this url and I got error " The requested resource is not available."

http://localhost:8080/DemoSpringMVC/hello1

I try to access this and "helloworld" still be displayed

http://localhost:8080/DemoSpringMVC/hello

I open Task manager and I figure out that the "javaw.exe" create a new instance every time I run my project, but the older version is always get affect. I try to kill all "javaw.exe" processes by hand, run the project again and it works.

So the question is, how to kill old "javaw.exe" process everytime I run my project??? Or maybe I build or run Maven project wrong way?

RESOLVED: I realize I can run a maven project follow the normal way (By tomcat), then the problem resolved. Thank you all.

Instead of running a second time, you probably want to redeploy your running code. See https://www.mkyong.com/eclipse/how-to-configure-hot-deploy-in-eclipse/

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