Spring Boot Failed to load resource: the server responded with a status of 404How to respond with HTTP 400 error in a Spring MVC @ResponseBody method returning String?Add context path to Spring Boot applicationHow to configure port for a Spring Boot applicationSpring Boot not serving static contentspring boot do not publish correctly font files from static dir (font-awesome)How to log SQL statements in Spring Boot?Failed to load resource: the server responded with a status of 404 (Not Found) in spring mvcDifference between Spring MVC and Spring BootFailed to load resource: the server responded with a status of 404Failed to load resource: the server responded with a status of 404?

Signing using digital signatures?

What happens when your group is victim of a surprise attack but you can't be surprised?

Word Wall of Whimsical Wordy Whatchamacallits

What does 2>&1 | tee mean?

Can gpxpy write .gpx file?

Should I include salary information on my CV?

The use of "I" and "we" used in the same sentence and other questions

Generate and Graph the Recamán Sequence

How can I check type T is among parameter pack Ts... in C++?

How often can a PC check with passive perception during a combat turn?

What do you call the action of someone tackling a stronger person?

Stepcounter after paragraph

Alphabet completion rate

Does anycast addressing add additional latency in any way?

“Faire” being used to mean “avoir l’air”?

Confusion about multiple information Sets

How fast can a ship with rotating habitats be accelerated?

How do I find and plot the intersection of these three surfaces?

Wilcoxon signed rank test – critical value for n>50

How well known and how commonly used was Huffman coding in 1979?

Children's short story about material that accelerates away from gravity

Are Finite Automata Turing Complete?

Should I tell my insurance company I have an unsecured loan for my new car?

Anagram Within an Anagram!



Spring Boot Failed to load resource: the server responded with a status of 404


How to respond with HTTP 400 error in a Spring MVC @ResponseBody method returning String?Add context path to Spring Boot applicationHow to configure port for a Spring Boot applicationSpring Boot not serving static contentspring boot do not publish correctly font files from static dir (font-awesome)How to log SQL statements in Spring Boot?Failed to load resource: the server responded with a status of 404 (Not Found) in spring mvcDifference between Spring MVC and Spring BootFailed to load resource: the server responded with a status of 404Failed to load resource: the server responded with a status of 404?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I am facing this error:



enter image description here




Failed to load resource: the server responded with a status of 404




Here is how I am loading css. Note that I am not using WebMvcConfigurer.



<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Material Design Bootstrap</title>
<!-- Font Awesome -->
<link rel="stylesheet" th:href="@https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" th:href="@/css/bootstrap.min.css">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" th:href="@/css/mdb.min.css">
<!-- Your custom styles (optional) -->
<link rel="stylesheet" th:href="@/css/style.css">
</head>


And I am loading js files at the end of the page (body).



 <body>

......

<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="/static/js/jquery-3.1.1.min.js" th:src="@/js/jquery-3.1.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="/static/js/popper.min.js" th:src="@/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="/static/js/bootstrap.min.js" th:src="@/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="/static/js/mdb.min.js" th:src="@/js/mdb.min.js"></script>
</body>


What could be the reason?



EDIT:



Here is my directory structure



enter image description here










share|improve this question
























  • What's your directory structure?

    – ISlimani
    Jun 27 '18 at 0:30











  • @DforTye I have added directory structure. Please have a look.

    – Faizan Mubasher
    Jun 27 '18 at 5:03

















2















I am facing this error:



enter image description here




Failed to load resource: the server responded with a status of 404




Here is how I am loading css. Note that I am not using WebMvcConfigurer.



<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Material Design Bootstrap</title>
<!-- Font Awesome -->
<link rel="stylesheet" th:href="@https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" th:href="@/css/bootstrap.min.css">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" th:href="@/css/mdb.min.css">
<!-- Your custom styles (optional) -->
<link rel="stylesheet" th:href="@/css/style.css">
</head>


And I am loading js files at the end of the page (body).



 <body>

......

<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="/static/js/jquery-3.1.1.min.js" th:src="@/js/jquery-3.1.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="/static/js/popper.min.js" th:src="@/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="/static/js/bootstrap.min.js" th:src="@/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="/static/js/mdb.min.js" th:src="@/js/mdb.min.js"></script>
</body>


What could be the reason?



EDIT:



Here is my directory structure



enter image description here










share|improve this question
























  • What's your directory structure?

    – ISlimani
    Jun 27 '18 at 0:30











  • @DforTye I have added directory structure. Please have a look.

    – Faizan Mubasher
    Jun 27 '18 at 5:03













2












2








2








I am facing this error:



enter image description here




Failed to load resource: the server responded with a status of 404




Here is how I am loading css. Note that I am not using WebMvcConfigurer.



<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Material Design Bootstrap</title>
<!-- Font Awesome -->
<link rel="stylesheet" th:href="@https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" th:href="@/css/bootstrap.min.css">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" th:href="@/css/mdb.min.css">
<!-- Your custom styles (optional) -->
<link rel="stylesheet" th:href="@/css/style.css">
</head>


And I am loading js files at the end of the page (body).



 <body>

......

<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="/static/js/jquery-3.1.1.min.js" th:src="@/js/jquery-3.1.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="/static/js/popper.min.js" th:src="@/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="/static/js/bootstrap.min.js" th:src="@/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="/static/js/mdb.min.js" th:src="@/js/mdb.min.js"></script>
</body>


What could be the reason?



EDIT:



Here is my directory structure



enter image description here










share|improve this question
















I am facing this error:



enter image description here




Failed to load resource: the server responded with a status of 404




Here is how I am loading css. Note that I am not using WebMvcConfigurer.



<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Material Design Bootstrap</title>
<!-- Font Awesome -->
<link rel="stylesheet" th:href="@https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" th:href="@/css/bootstrap.min.css">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" th:href="@/css/mdb.min.css">
<!-- Your custom styles (optional) -->
<link rel="stylesheet" th:href="@/css/style.css">
</head>


And I am loading js files at the end of the page (body).



 <body>

......

<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="/static/js/jquery-3.1.1.min.js" th:src="@/js/jquery-3.1.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="/static/js/popper.min.js" th:src="@/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="/static/js/bootstrap.min.js" th:src="@/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="/static/js/mdb.min.js" th:src="@/js/mdb.min.js"></script>
</body>


What could be the reason?



EDIT:



Here is my directory structure



enter image description here







spring spring-mvc spring-boot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 27 '18 at 5:02







Faizan Mubasher

















asked Jun 26 '18 at 13:29









Faizan MubasherFaizan Mubasher

2,3043 gold badges23 silver badges49 bronze badges




2,3043 gold badges23 silver badges49 bronze badges












  • What's your directory structure?

    – ISlimani
    Jun 27 '18 at 0:30











  • @DforTye I have added directory structure. Please have a look.

    – Faizan Mubasher
    Jun 27 '18 at 5:03

















  • What's your directory structure?

    – ISlimani
    Jun 27 '18 at 0:30











  • @DforTye I have added directory structure. Please have a look.

    – Faizan Mubasher
    Jun 27 '18 at 5:03
















What's your directory structure?

– ISlimani
Jun 27 '18 at 0:30





What's your directory structure?

– ISlimani
Jun 27 '18 at 0:30













@DforTye I have added directory structure. Please have a look.

– Faizan Mubasher
Jun 27 '18 at 5:03





@DforTye I have added directory structure. Please have a look.

– Faizan Mubasher
Jun 27 '18 at 5:03












3 Answers
3






active

oldest

votes


















3














Seems you are doing mistake while you are loading jquery. Your jquery is jquery-3.3.1.min.js but you are loading jquery-3.1.1.min.js



 <script type="text/javascript" src="/static/js/jquery-3.1.1.min.js" th:src="@/js/jquery-3.1.1.min.js"></script>


So check jquery version.






share|improve this answer























  • Oh man you got it right. Such a silly mistake. Thanks anyway.

    – Faizan Mubasher
    Jun 27 '18 at 5:55











  • My pleasure man.

    – Avijit Barua
    Jun 27 '18 at 5:57


















0














directory structure



Load css



<link href="../static/assets/css/materialize.min.css" type="text/css"
rel="stylesheet" th:href="@/assets/css/materialize.min.css"
media="screen,projection">


Load js



<script type="text/javascript" src="../static/assets/js/materialize.min.js"
th:src="@/assets/js/materialize.min.js"></script>





share|improve this answer























  • I have added my directory structure. Please have a look.

    – Faizan Mubasher
    Jun 27 '18 at 5:11


















0














this worked for me.



this is how my files are like in the static folder:



this is how i include the files from the static folder into my html pages:





i get rid of the static folder in the path since the server i guess knows to look for static content in the static folder. so the path for my all.min.css will be.



http://127.0.0.1:8080/js/demo/all.min.css



it will search for in the static folder.



if you add static i.e




link href="/static/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"




the server will look for




http://127.0.0.1:8080/static/static/js/demo/all.min.css




and it won't get that path



remember to allow the routes in antmatchers if you're using spring security. see attached image



allow the routes to the folders in static folder if using spring security:






share|improve this answer



























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51044143%2fspring-boot-failed-to-load-resource-the-server-responded-with-a-status-of-404%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    Seems you are doing mistake while you are loading jquery. Your jquery is jquery-3.3.1.min.js but you are loading jquery-3.1.1.min.js



     <script type="text/javascript" src="/static/js/jquery-3.1.1.min.js" th:src="@/js/jquery-3.1.1.min.js"></script>


    So check jquery version.






    share|improve this answer























    • Oh man you got it right. Such a silly mistake. Thanks anyway.

      – Faizan Mubasher
      Jun 27 '18 at 5:55











    • My pleasure man.

      – Avijit Barua
      Jun 27 '18 at 5:57















    3














    Seems you are doing mistake while you are loading jquery. Your jquery is jquery-3.3.1.min.js but you are loading jquery-3.1.1.min.js



     <script type="text/javascript" src="/static/js/jquery-3.1.1.min.js" th:src="@/js/jquery-3.1.1.min.js"></script>


    So check jquery version.






    share|improve this answer























    • Oh man you got it right. Such a silly mistake. Thanks anyway.

      – Faizan Mubasher
      Jun 27 '18 at 5:55











    • My pleasure man.

      – Avijit Barua
      Jun 27 '18 at 5:57













    3












    3








    3







    Seems you are doing mistake while you are loading jquery. Your jquery is jquery-3.3.1.min.js but you are loading jquery-3.1.1.min.js



     <script type="text/javascript" src="/static/js/jquery-3.1.1.min.js" th:src="@/js/jquery-3.1.1.min.js"></script>


    So check jquery version.






    share|improve this answer













    Seems you are doing mistake while you are loading jquery. Your jquery is jquery-3.3.1.min.js but you are loading jquery-3.1.1.min.js



     <script type="text/javascript" src="/static/js/jquery-3.1.1.min.js" th:src="@/js/jquery-3.1.1.min.js"></script>


    So check jquery version.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jun 27 '18 at 5:39









    Avijit BaruaAvijit Barua

    1,7171 gold badge3 silver badges22 bronze badges




    1,7171 gold badge3 silver badges22 bronze badges












    • Oh man you got it right. Such a silly mistake. Thanks anyway.

      – Faizan Mubasher
      Jun 27 '18 at 5:55











    • My pleasure man.

      – Avijit Barua
      Jun 27 '18 at 5:57

















    • Oh man you got it right. Such a silly mistake. Thanks anyway.

      – Faizan Mubasher
      Jun 27 '18 at 5:55











    • My pleasure man.

      – Avijit Barua
      Jun 27 '18 at 5:57
















    Oh man you got it right. Such a silly mistake. Thanks anyway.

    – Faizan Mubasher
    Jun 27 '18 at 5:55





    Oh man you got it right. Such a silly mistake. Thanks anyway.

    – Faizan Mubasher
    Jun 27 '18 at 5:55













    My pleasure man.

    – Avijit Barua
    Jun 27 '18 at 5:57





    My pleasure man.

    – Avijit Barua
    Jun 27 '18 at 5:57













    0














    directory structure



    Load css



    <link href="../static/assets/css/materialize.min.css" type="text/css"
    rel="stylesheet" th:href="@/assets/css/materialize.min.css"
    media="screen,projection">


    Load js



    <script type="text/javascript" src="../static/assets/js/materialize.min.js"
    th:src="@/assets/js/materialize.min.js"></script>





    share|improve this answer























    • I have added my directory structure. Please have a look.

      – Faizan Mubasher
      Jun 27 '18 at 5:11















    0














    directory structure



    Load css



    <link href="../static/assets/css/materialize.min.css" type="text/css"
    rel="stylesheet" th:href="@/assets/css/materialize.min.css"
    media="screen,projection">


    Load js



    <script type="text/javascript" src="../static/assets/js/materialize.min.js"
    th:src="@/assets/js/materialize.min.js"></script>





    share|improve this answer























    • I have added my directory structure. Please have a look.

      – Faizan Mubasher
      Jun 27 '18 at 5:11













    0












    0








    0







    directory structure



    Load css



    <link href="../static/assets/css/materialize.min.css" type="text/css"
    rel="stylesheet" th:href="@/assets/css/materialize.min.css"
    media="screen,projection">


    Load js



    <script type="text/javascript" src="../static/assets/js/materialize.min.js"
    th:src="@/assets/js/materialize.min.js"></script>





    share|improve this answer













    directory structure



    Load css



    <link href="../static/assets/css/materialize.min.css" type="text/css"
    rel="stylesheet" th:href="@/assets/css/materialize.min.css"
    media="screen,projection">


    Load js



    <script type="text/javascript" src="../static/assets/js/materialize.min.js"
    th:src="@/assets/js/materialize.min.js"></script>






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jun 27 '18 at 0:36









    ISlimaniISlimani

    8626 silver badges12 bronze badges




    8626 silver badges12 bronze badges












    • I have added my directory structure. Please have a look.

      – Faizan Mubasher
      Jun 27 '18 at 5:11

















    • I have added my directory structure. Please have a look.

      – Faizan Mubasher
      Jun 27 '18 at 5:11
















    I have added my directory structure. Please have a look.

    – Faizan Mubasher
    Jun 27 '18 at 5:11





    I have added my directory structure. Please have a look.

    – Faizan Mubasher
    Jun 27 '18 at 5:11











    0














    this worked for me.



    this is how my files are like in the static folder:



    this is how i include the files from the static folder into my html pages:





    i get rid of the static folder in the path since the server i guess knows to look for static content in the static folder. so the path for my all.min.css will be.



    http://127.0.0.1:8080/js/demo/all.min.css



    it will search for in the static folder.



    if you add static i.e




    link href="/static/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"




    the server will look for




    http://127.0.0.1:8080/static/static/js/demo/all.min.css




    and it won't get that path



    remember to allow the routes in antmatchers if you're using spring security. see attached image



    allow the routes to the folders in static folder if using spring security:






    share|improve this answer





























      0














      this worked for me.



      this is how my files are like in the static folder:



      this is how i include the files from the static folder into my html pages:





      i get rid of the static folder in the path since the server i guess knows to look for static content in the static folder. so the path for my all.min.css will be.



      http://127.0.0.1:8080/js/demo/all.min.css



      it will search for in the static folder.



      if you add static i.e




      link href="/static/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"




      the server will look for




      http://127.0.0.1:8080/static/static/js/demo/all.min.css




      and it won't get that path



      remember to allow the routes in antmatchers if you're using spring security. see attached image



      allow the routes to the folders in static folder if using spring security:






      share|improve this answer



























        0












        0








        0







        this worked for me.



        this is how my files are like in the static folder:



        this is how i include the files from the static folder into my html pages:





        i get rid of the static folder in the path since the server i guess knows to look for static content in the static folder. so the path for my all.min.css will be.



        http://127.0.0.1:8080/js/demo/all.min.css



        it will search for in the static folder.



        if you add static i.e




        link href="/static/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"




        the server will look for




        http://127.0.0.1:8080/static/static/js/demo/all.min.css




        and it won't get that path



        remember to allow the routes in antmatchers if you're using spring security. see attached image



        allow the routes to the folders in static folder if using spring security:






        share|improve this answer















        this worked for me.



        this is how my files are like in the static folder:



        this is how i include the files from the static folder into my html pages:





        i get rid of the static folder in the path since the server i guess knows to look for static content in the static folder. so the path for my all.min.css will be.



        http://127.0.0.1:8080/js/demo/all.min.css



        it will search for in the static folder.



        if you add static i.e




        link href="/static/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"




        the server will look for




        http://127.0.0.1:8080/static/static/js/demo/all.min.css




        and it won't get that path



        remember to allow the routes in antmatchers if you're using spring security. see attached image



        allow the routes to the folders in static folder if using spring security:







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 25 at 11:40









        Armali

        8,23012 gold badges39 silver badges108 bronze badges




        8,23012 gold badges39 silver badges108 bronze badges










        answered Mar 25 at 11:17









        bugzbugz

        113 bronze badges




        113 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51044143%2fspring-boot-failed-to-load-resource-the-server-responded-with-a-status-of-404%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해