Я читал так много тем, которые имели такую же проблему с моим случаем, но не нашли ничего, чтобы решить мою проблему. Это моя конфигурация сервлета с использованием именВесна не найти контроллер при запуске приложения
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:mail="http://www.springframework.org/schema/integration/mail"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/integration/mail
http://www.springframework.org/schema/integration/mail/spring-integration-mail-1.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
<!-- Configures the @Controller programming model -->
<mvc:annotation-driven />
<!-- Scans the classpath of this application for @Components to deploy as beans -->
<context:component-scan base-package="fi.vietjob" />
<!-- Resolves view names to protected .jsp resources within the /WEB-INF/views
directory -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
<!-- Forwards requests to the "/" resource to the "welcome" view -->
<mvc:view-controller path="/" view-name="index" />
<!-- location of static content (images, js and css files) -->
<mvc:resources mapping="/resources/**" location="/resources/" />
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:lang" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="vn" />
</bean>
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" />
</bean>
</mvc:interceptors>
<!--config for upload image -->
<bean id="multipartResolver" class="org.springframework.web.multipart.support.StandardServletMultipartResolver" />
</beans>
Вот мой stackstrace при перезапуске сервера
Jan 11, 2017 9:34:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.14
Jan 11, 2017 9:34:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Sep 24 2014 09:01:51
Jan 11, 2017 9:34:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.14.0
Jan 11, 2017 9:34:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Mac OS X
Jan 11, 2017 9:34:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.10.5
Jan 11, 2017 9:34:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86_64
Jan 11, 2017 9:34:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_11-b12
Jan 11, 2017 9:34:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Jan 11, 2017 9:34:17 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/dinhthinh/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Jan 11, 2017 9:34:17 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:vietduuni' did not find a matching property.
Jan 11, 2017 9:34:18 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8001"]
Jan 11, 2017 9:34:18 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Jan 11, 2017 9:34:18 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Jan 11, 2017 9:34:18 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Jan 11, 2017 9:34:18 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1064 ms
Jan 11, 2017 9:34:18 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 11, 2017 9:34:18 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.14
Jan 11, 2017 9:34:18 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jan 11, 2017 9:34:20 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 11, 2017 9:34:21 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Jan 11, 2017 9:34:23 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'vietjob'
Jan 11, 2017 9:34:25 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8001"]
Jan 11, 2017 9:34:25 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Jan 11, 2017 9:34:25 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 7262 ms
конфигурации web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Servlet config begin -->
<servlet>
<servlet-name>vietjob</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>vietjob</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- end-->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Begin load Spring Filter Chain config from servlet vietjob -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/vietjob-security.xml
</param-value>
</context-param>
<!-- end load -->
<!-- Begin Spring security config-->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Когда я запускаю мое приложение, ничего не нашел ошибки, но в stacktrace, в котором не отображается текстовая строка, сообщающая о загрузке контроллеров. Поэтому, когда я ударил ссылку, я получил ошибку 404. Кто-нибудь может мне помочь ?!