Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

[Spring]Get images from external resources: Issue with @EnableWebMvc and WebMvcConfigurationSupport

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a spring boot application and I am trying to get images from external folder on disk, here is my code:



But when I launch the application, I got this error message:

> o.s.web.servlet.PageNotFound: No mapping for GET /myapp/index
> o.s.b.w.servlet.support.ErrorPageFilter  : Cannot forward to error
> page for request [/] as the response has already been committed.



Even if I remove @EnableWebMvc and I extend WebMvcConfigurationSupport directly, I am getting the same issue.

 1.  Why am I getting this issue?

 2. Is it possible to get images from external resources without using @EnableWebMvc or WebMvcConfigurationSupport?

Thanks
 
Rancher
Posts: 527
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where is myapp/index coming from?  I don't see that in the code.
 
Deparis Momo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my WelcomeController Class:



And my spring security Class:

 
Ranch Hand
Posts: 1871
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Deparis,
What is your project structure?
You may need to put the images under webapp folder and see if that works first.
Reference:
https://stackoverflow.com/questions/37240513/o-s-boot-context-web-errorpage-cannot-forward-to-error-page-for-request-as
 
Deparis Momo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I resolved the problem. Firstly I removed @EnableWebMvc and WebMvcConfigurationSupport, then I noted that there was an issue in the url. I put :



Instead of:



As I am a Windows user.

Thanks
 
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF
htttp://www.e-iceblue.com/free-apis.html
    Bookmark Topic Watch Topic
  • New Topic