0

I am new to spring mvc and I am trying to build a Java web application. Below is the error I got:

1:14:11.411 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/template/layout/styles/layout.css]
01:14:11.412 [http-nio-8080-exec-10] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/template/layout/styles/layout.css] in DispatcherServlet with name 'spring-mvc'
01:14:11.412 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.413 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/480x360.png]
01:14:11.414 [http-nio-8080-exec-8] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/480x360.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.414 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.420 [http-nio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.min.js]
01:14:11.421 [http-nio-8080-exec-2] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.min.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.421 [http-nio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.425 [http-nio-8080-exec-7] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.backtotop.js]
01:14:11.426 [http-nio-8080-exec-7] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.backtotop.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.426 [http-nio-8080-exec-7] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.430 [http-nio-8080-exec-1] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.mobilemenu.js]
01:14:11.430 [http-nio-8080-exec-1] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.mobilemenu.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.430 [http-nio-8080-exec-1] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.436 [http-nio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/100x100.png]
01:14:11.436 [http-nio-8080-exec-3] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/100x100.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.436 [http-nio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.441 [http-nio-8080-exec-5] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/320x220.png]
01:14:11.441 [http-nio-8080-exec-5] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/320x220.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.441 [http-nio-8080-exec-5] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.462 [http-nio-8080-exec-6] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.min.js]
01:14:11.463 [http-nio-8080-exec-6] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.min.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.463 [http-nio-8080-exec-6] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.474 [http-nio-8080-exec-4] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/backgrounds/01.png]
01:14:11.474 [http-nio-8080-exec-4] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/backgrounds/01.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.474 [http-nio-8080-exec-4] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.482 [http-nio-8080-exec-9] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/backgrounds/02.png]
01:14:11.483 [http-nio-8080-exec-9] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/backgrounds/02.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.483 [http-nio-8080-exec-9] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.498 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/backgrounds/03.png]
01:14:11.499 [http-nio-8080-exec-10] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/backgrounds/03.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.499 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.583 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.backtotop.js]
01:14:11.584 [http-nio-8080-exec-8] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.backtotop.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.584 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.601 [http-nio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.mobilemenu.js]
01:14:11.602 [http-nio-8080-exec-2] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.mobilemenu.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.602 [http-nio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request

** web.xml:**

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
         http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
   id="WebApp_ID" version="3.1">
  
 <display-name>TooO</display-name>
 <welcome-file-list>
   <welcome-file>welcome.jsp</welcome-file>
 </welcome-file-list>
 
 <servlet>
     <servlet-name>spring-mvc</servlet-name>
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
     <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
     <servlet-name>spring-mvc</servlet-name>
     <url-pattern>/</url-pattern>
 </servlet-mapping>

</web-app>

My spring-mvc-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <import resource="classpath:config/user-beans.xml" />
    <context:component-scan base-package="spring.mvc" />
    <context:annotation-config />
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>
</beans>

my welcome.jsp:

<!DOCTYPE html>
<html lang="en">
<!-- To declare your language - read more here: https://www.w3.org/International/questions/qa-html-language-declarations -->
<head>
<title>TooO | New Smoking Experience1</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="template/layout/styles/layout.css" rel="stylesheet" type="text/css" media="all">
</head>

My project overview: enter image description here

I have set welcome.jsp as the welcome-file in web.xml, and in the welcome.jsp, I am using template/layout/styles/layout.css for stylesheet, however, when I run the program and open the webpage, the style was not set in the webpage. But the path to the layout.css is correct, I am wondering if the resolver I sett in servlet file is not setting correctly.

For example, in the first error shown in the console:

1:14:11.411 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/template/layout/styles/layout.css] 01:14:11.412 [http-nio-8080-exec-10] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/template/layout/styles/layout.css] in DispatcherServlet with name 'spring-mvc'

Which is saying that it cannot find the layout.css file.

Leo Li
  • 73
  • 1
  • 3
  • 10

0 Answers0