java - Spring Boot - "Path index.html does not start with a "/" character" -


i learning spring-boot , angularjs, using eclipse ide, , tomcat 8.0.30 (64 bits) container, running inside eclipse. maven project.

although application basic , silly, getting error when accessing application via browser. problem is, if don't enter url slash (/) in end, got error. server logs throws this:

url http://localhost:8080/app

java.lang.illegalargumentexception: path index.html not start "/" character 

however, if enter url http://localhost:8080/app/ application runs fine.

as may know, spring-boot applications don't rely on web.xml. in fact, spring-boot loads index.html welcome page, or supposed to.

i ran application outside eclipse, deploying tomcat container. got 404 without slash, , slash, works fine. running in self-contained mode (embeeded tomcat) works fine.

why application not redirect index.html without slash in end?

you can find entire application here (i tagged it):

https://github.com/ajkret/spring-boot-sample/tree/slash-problem

here application.java

@springbootapplication @componentscan(basepackages = { "br.com.cinq.greet" }) @enableautoconfiguration public class application extends springbootservletinitializer {      @override     protected springapplicationbuilder configure(springapplicationbuilder application) {         return application.sources(application.class);     }      public static void main(string[] args) {         new application().configure(new springapplicationbuilder(application.class)).run(args);     } } 

here resourceconfig, jersey.

@configuration @applicationpath("rest") public class config extends resourceconfig {      public config() {         register(greetresource.class);     } } 

here greetresource, typical jersey resource:

@path("/greet") public class greetresource {     logger logger = loggerfactory.getlogger(greetresource.class);      // now, store information on bean, in memory     @autowired     greet greet;      @get     @produces(mediatype.application_json)     public response greet() {         logger.debug("received requisition");         return response.ok().entity(greet).build();     }      @post     @consumes(mediatype.application_json)     public response greet(greet greet) {         try {             this.greet.setmessage(greet.getmessage());             logger.info("greeting message updated {}",this.greet.getmessage());         } catch (exception e) {             logger.error("an exception occurred during greet message update", e);             return response.status(status.internal_server_error).entity("exception").build();         }          return response.ok().build();     } } 

that it, java classes may interfere process here.

here dependencies pom:

<dependencies>     <dependency>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-web</artifactid>     </dependency>     <dependency>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-jersey</artifactid>     </dependency>     <dependency>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-test</artifactid>         <scope>test</scope>     </dependency>     <dependency>         <groupid>org.slf4j</groupid>         <artifactid>slf4j-api</artifactid>     </dependency>      <dependency>         <groupid>ch.qos.logback</groupid>         <artifactid>logback-classic</artifactid>     </dependency>  </dependencies> 

update

i've installed tomcat 8.0.24, , problem solved, apparently.

are there new rules, rfcs, new don't know slash?


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -