关于tomcat部署应用无法访问前端页面的问题

admin
admin
admin
2162
文章
5
评论
2021年11月8日22:25:48关于tomcat部署应用无法访问前端页面的问题已关闭评论 372 9863字阅读32分52秒

最近在做实训项目的时候使用到了 ssm框架,在项目环境搭建好后,运行程序时,一直遇到页面访问404错误。

项目运行日志如下:

十一月 13, 2020 11:56:07 上午 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:javajdkbin;C:WindowsSunJavabin;C:Windowssystem32;C:Windows;D:/java/jdk/bin/../jre/bin/server;D:/java/jdk/bin/../jre/bin;D:/java/jdk/bin/../jre/lib/amd64;D:javajdkbin;D:javaJREbin;D:ernvgradlegradle-6.6.1-allgradle-6.6.1bin;C:sqlite3;C:ProgramDataOracleJavajavapath;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsiCLS;C:Program FilesIntelIntel(R) Management Engine ComponentsiCLS;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:WindowsSystem32OpenSSH;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:Program Files (x86)Microsoft SQL Server100ToolsBinn;C:Program FilesMicrosoft SQL Server100ToolsBinn;C:Program FilesMicrosoft SQL Server100DTSBinn;d:pythonScripts;D:爬虫所需软件数据库;D:Gitcmd;D:bin;C:Program Files (x86)Microsoft SQL Server110ToolsBinn;C:Program FilesMicrosoft SQL Server110ToolsBinn;C:Program FilesMicrosoft SQL Server110DTSBinn;D:MySQLMySQL Server 5.5bin;D:Python;C:Program FilesTerminusTerminus.exe;D:toolsmyBlognode-v12.1.0-win-x64;D:toolsmyBlognode-v12.1.0-win-x64node-global;D:toolsmyBlognode-v12.1.0-win-x64node-globalnode_moduleshexonode_modules.bin;D:ernvjavaapache-maven-3.6.3-binapache-maven-3.6.3bin;D:ernvlibopencvOpencv3.4.2Opencv3.4.2WindowSoftopencvbuildx64vc15bin;I:软件安装包mrunitwindows系统hadoop插件-winutilsmasterwinutils-masterhadoop-2.6.3bin;C:UserserbinAppDataLocalMicrosoftWindowsApps;D:ProGramToolbyToolPyCharm 2018.3.2bin;D:爬虫所需软件数据库mysql-5.6.43-winx64bin;D:toolsProgramsFiddler;D:IDEJetBrainsIDEA 2020.1IntelliJ IDEA 2020.1bin;C:UserserbinAppDataLocalPandoc;D:goideaGoLand 2020.1bin;D:eclipse-jee-neon-3-win32-x86_64eclipse;;.
十一月 13, 2020 11:56:07 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:CRMSystem' did not find a matching property.
十一月 13, 2020 11:56:08 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-nio-8080"]
十一月 13, 2020 11:56:08 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
十一月 13, 2020 11:56:08 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-nio-8009"]
十一月 13, 2020 11:56:08 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
十一月 13, 2020 11:56:08 上午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 866 ms
十一月 13, 2020 11:56:08 上午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
十一月 13, 2020 11:56:08 上午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.0.5
十一月 13, 2020 11:56:12 上午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
十一月 13, 2020 11:56:12 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-nio-8080"]
十一月 13, 2020 11:56:12 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-nio-8009"]
十一月 13, 2020 11:56:12 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 3826 ms
十一月 13, 2020 11:56:13 上午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'SpringMVC'
十一月 13, 2020 11:56:13 上午 org.springframework.web.servlet.DispatcherServlet initServletBean
信息: FrameworkServlet 'SpringMVC': initialization started
十一月 13, 2020 11:56:13 上午 org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
信息: Refreshing WebApplicationContext for namespace 'SpringMVC-servlet': startup date [Fri Nov 13 11:56:13 CST 2020]; root of context hierarchy
十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:Language Procticejavapro20201109.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsCRMSystemWEB-INFclassesspringspring-dao.xml]
十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:Language Procticejavapro20201109.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsCRMSystemWEB-INFclassesspringspring-mvc.xml]
十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:Language Procticejavapro20201109.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsCRMSystemWEB-INFclassesspringspring-service.xml]
十一月 13, 2020 11:56:14 上午 org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
信息: Loading properties file from class path resource [jdbc.properties]
十一月 13, 2020 11:56:14 上午 com.mchange.v2.log.MLog 
信息: MLog clients using java 1.4+ standard logging.
十一月 13, 2020 11:56:14 上午 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
11:56:14,733 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
11:56:14,734 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
11:56:14,734 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/G:/Language%20Proctice/java/pro/20201109/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/CRMSystem/WEB-INF/classes/logback.xml]
11:56:14,868 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
11:56:14,878 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
11:56:14,911 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
11:56:15,026 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
11:56:15,026 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
11:56:15,029 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11:56:15,031 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5ad72777 - Registering current configuration as safe fallback point
11:56:15.057 [http-nio-8080-exec-2] DEBUG org.apache.ibatis.logging.LogFactory - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
11:56:15.272 [http-nio-8080-exec-2] DEBUG org.apache.ibatis.io.VFS - Class not found: org.jboss.vfs.VFS
11:56:15.272 [http-nio-8080-exec-2] DEBUG org.apache.ibatis.io.JBoss6VFS - JBoss 6 VFS API is not available in this environment.
11:56:15.275 [http-nio-8080-exec-2] DEBUG org.apache.ibatis.io.VFS - Class not found: org.jboss.vfs.VirtualFile
11:56:15.277 [http-nio-8080-exec-2] DEBUG org.apache.ibatis.io.VFS - VFS implementation org.apache.ibatis.io.JBoss6VFS is not valid in this environment.
11:56:15.277 [http-nio-8080-exec-2] DEBUG org.apache.ibatis.io.VFS - Using VFS adapter org.apache.ibatis.io.DefaultVFS
11:56:15.279 [http-nio-8080-exec-2] DEBUG o.m.spring.SqlSessionFactoryBean - Scanned package: 'com.crm.entity' for aliases
11:56:15.367 [http-nio-8080-exec-2] DEBUG o.m.spring.SqlSessionFactoryBean - Parsed configuration file: 'class path resource [mybatis-config.xml]'
11:56:15.369 [http-nio-8080-exec-2] DEBUG o.m.spring.SqlSessionFactoryBean - Property 'mapperLocations' was not specified or no matching resources found
十一月 13, 2020 11:56:16 上午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
信息: Looking for @ControllerAdvice: WebApplicationContext for namespace 'SpringMVC-servlet': startup date [Fri Nov 13 11:56:13 CST 2020]; root of context hierarchy
十一月 13, 2020 11:56:16 上午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
信息: Looking for @ControllerAdvice: WebApplicationContext for namespace 'SpringMVC-servlet': startup date [Fri Nov 13 11:56:13 CST 2020]; root of context hierarchy
十一月 13, 2020 11:56:16 上午 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
信息: Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
十一月 13, 2020 11:56:16 上午 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
信息: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'
十一月 13, 2020 11:56:16 上午 org.springframework.web.servlet.DispatcherServlet initServletBean
信息: FrameworkServlet 'SpringMVC': initialization completed in 3240 ms

刚开始,我觉得是ssm环境问题,spirng-mvc没有正确配置,但是仔细观察日志,可以看到:

spring mvc 已经成功接管了我的静态资源

十一月 13, 2020 11:56:13 上午 org.springframework.web.servlet.DispatcherServlet initServletBean
信息: FrameworkServlet 'SpringMVC': initialization started
十一月 13, 2020 11:56:16 上午 org.springframework.web.servlet.DispatcherServlet initServletBean

spring三个配置文件都已经加载进环境

十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:Language Procticejavapro20201109.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsCRMSystemWEB-INFclassesspringspring-dao.xml]
十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:Language Procticejavapro20201109.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsCRMSystemWEB-INFclassesspringspring-mvc.xml]
十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:Language Procticejavapro20201109.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsCRMSystemWEB-INFclassesspringspring-service.xml]

资源目录和orm映射模型目录已经加载

所以排除对ssm环境配置的怀疑,我再次查看tomcat。

在检验端口号未被占用等问题以后,我将tomcat8.0.5换成了tomcat8.5
结果是成功访问到了前端页面,解决了这个问题。

文章来源于互联网:关于tomcat部署应用无法访问前端页面的问题

未分类