web.xml
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
mvc-dispatcher-servlet.xml
<context:component-scan base-package="com.XXX.controller"/>
<!-- (jsimage) -->
<mvc:default-servlet-handler/>
<!-- -->
<mvc:annotation-driven/>
<!--ViewResolver -->
<!--ServletJSP-->
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="suffix" value=".jsp"/>
</bean>
I think the code and configuration should be fine. At startup, it is tomcat 404
. It is also useless to change /
to / *
in accordance with the solution of related problems .
thinks it may be a problem with tomcat
the following is the log at startup:
"C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\catalina.bat" run
[2018-04-13 11:00:50,753] Artifact springmvcdemo5:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE: "C:\Users\inren\.IntelliJIdea2018.1\system\tomcat\Unnamed_springmvcdemo5_2"
Using CATALINA_HOME: "C:\Program Files\Apache Software Foundation\Tomcat 8.0"
Using CATALINA_TMPDIR: "C:\Program Files\Apache Software Foundation\Tomcat 8.0\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_144"
Using CLASSPATH: "C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\tomcat-juli.jar"
13-Apr-2018 11:00:51.747 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.45
13-Apr-2018 11:00:51.750 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 26 2017 20:06:07 UTC
13-Apr-2018 11:00:51.750 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.45.0
13-Apr-2018 11:00:51.751 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
13-Apr-2018 11:00:51.751 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
13-Apr-2018 11:00:51.751 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
13-Apr-2018 11:00:51.751 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk1.8.0_144\jre
13-Apr-2018 11:00:51.751 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_144-b01
13-Apr-2018 11:00:51.751 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
13-Apr-2018 11:00:51.751 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\inren\.IntelliJIdea2018.1\system\tomcat\Unnamed_springmvcdemo5_2
13-Apr-2018 11:00:51.751 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 8.0
13-Apr-2018 11:00:51.752 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\inren\.IntelliJIdea2018.1\system\tomcat\Unnamed_springmvcdemo5_2\conf\logging.properties
13-Apr-2018 11:00:51.752 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
13-Apr-2018 11:00:51.752 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
13-Apr-2018 11:00:51.752 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
13-Apr-2018 11:00:51.752 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
13-Apr-2018 11:00:51.753 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
13-Apr-2018 11:00:51.753 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
13-Apr-2018 11:00:51.753 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
13-Apr-2018 11:00:51.753 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
13-Apr-2018 11:00:51.753 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 8.0\endorsed
13-Apr-2018 11:00:51.753 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\inren\.IntelliJIdea2018.1\system\tomcat\Unnamed_springmvcdemo5_2
13-Apr-2018 11:00:51.753 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.0
13-Apr-2018 11:00:51.753 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 8.0\temp
13-Apr-2018 11:00:51.754 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_144\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;D:\oracle\product\11.2.0\client_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\TortoiseSVN\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Git\cmd;C:\Program Files (x86)\VisualSVN\bin;C:\Program Files\nodejs\;";D:\Tools\apache-maven-3.5.3\bin";"C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;";;.
13-Apr-2018 11:00:51.921 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
13-Apr-2018 11:00:51.947 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
13-Apr-2018 11:00:51.949 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
13-Apr-2018 11:00:51.952 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
13-Apr-2018 11:00:51.953 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 606 ms
13-Apr-2018 11:00:51.993 [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
13-Apr-2018 11:00:51.994 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.45
13-Apr-2018 11:00:52.004 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
13-Apr-2018 11:00:52.013 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
13-Apr-2018 11:00:52.016 [main] org.apache.catalina.startup.Catalina.start Server startup in 62 ms
Connected to server
[2018-04-13 11:00:52,322] Artifact springmvcdemo5:war exploded: Artifact is being deployed, please wait...
13-Apr-2018 11:00:54.459 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 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.
[2018-04-13 11:00:54,526] Artifact springmvcdemo5:war exploded: Artifact is deployed successfully
[2018-04-13 11:00:54,526] Artifact springmvcdemo5:war exploded: Deploy took 2,205 milliseconds
13-Apr-2018 11:01:02.006 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\manager
13-Apr-2018 11:01:02.064 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\manager has finished in 57 ms
.IntelliJIdea 2018.1\ system\ tomcat\ Unnamed_springmvcdemo5_2
there is no corresponding file generated here?