Sai
Sai

Reputation: 461

mvn jetty:run giving error 404

I have a Spring MVC web application and tried running it using Jetty. But whenever I type

mvn jetty: run

I get the proper sequence of events ending in "Jetty Server Started"

But however when I try to open the browser and type in

http:localhost:8080/app

I get Error 404 page Not found

here is my pom.xml jetty part

<plugin>
  <!-- This plugin is needed for the servlet example -->
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>7.2.0.v20101020</version>
  <configuration>
    <webApp>
      <contextPath>/app</contextPath>
    </webApp>
  </configuration>
</plugin>

my controller is mapped to @RequestMapping("/") and my servlet is also mapped to /. The pom.xml build name is app thus the URL is http://localhost:8080/app

Any help with this would be great. I have also tried with Jetty v9 and that doesn't work either

Upvotes: 1

Views: 4036

Answers (1)

SparkOn
SparkOn

Reputation: 8946

Try this it works fine

Edit

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.8</version>
       <configuration>
          <contextPath>/app</contextPath>
       </configuration>
</plugin>

First thing http:localhost:8080/app is wrong it should be http://localhost:8080/app if you give this url then you must have a landing page that you can specify in web.xml Like this

<welcome-file-list>
   <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

So simply try to access the url http://localhost:8080/app/index.jsp where there must be some index.jsp under the web-content folder

Upvotes: 4

Related Questions