0

I have an issue after I install postman. I try to work with REST service but firstly I want to check how it works on normal browser. So I tried on latest pages with normal view like that one below:

@Controller
public class HomeController {

@RequestMapping("/")
public String welcome(Model model)
{
    model.addAttribute("greeting", "Witaj w sklepie internetowym");
    model.addAttribute("tagline", "Wyjątkowym i jedynym sklepie");

    return "welcome";
}
@RequestMapping ("/welcome/greeting")
public String greeting() {
        return "welcome";
    }
}

It works fine I get back the .jsp page. Later I want to get the REST page in postman:

@Controller
@RequestMapping(value = "rest/cart")
public class CartRestController {

    @Autowired
    private ICartService cartService;
    @Autowired
    private IProductService productService;

    @RequestMapping(method = RequestMethod.POST)
    public @ResponseBody Cart create(@RequestBody Cart cart) {
        return cartService.create(cart);
    }

But then i receive HTTP 404 - not found status, and even if I want to get my "normal" pages with view i get always HTTP 404 status. In console log I getting also this error below but the server starts. So i dont know I have that one before. I tried to remedy with it like someone said on this answer https://stackoverflow.com/a/8128255/7491837 but it dont help me.

SEVERE: Error configuring application listener of class [org.springframework.web.context.ContextLoaderListener]
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

And also i tried to turn off my code with REST services but it dosen't help me. Any ideas what can be wrong? I'm stuck..

Adriano
  • 874
  • 2
  • 11
  • 37

1 Answers1

0

Not sure which server you are using. Hope the below helps :

below are the things that you can try out :

  • Add all the necessary jar files in "Deployment Assembly".
  • Please do a clean build of your project and re-check.
  • Remove the deployed file from your server.
  • Also clean the server (Tomcat/Websphere) Work Directory (Right click on Tomcat server and then do Clean Tomcat Work Directory).
  • If this doesn't work then delete your server and re-install it properly and then check.

If the above doesn't work then do :

  • Create a new workspace.
  • Add server.
  • Add your project.
  • Add all necessary jar files in Deployment Assembly.
  • Clean Build.
  • Deploy in server and check.
Som
  • 1,522
  • 1
  • 15
  • 48