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

(编辑:jimmy 日期: 2024/12/22 浏览:2)

最近在做实训项目的时候使用到了 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:\java\jdk\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/java/jdk/bin/../jre/bin/server;D:/java/jdk/bin/../jre/bin;D:/java/jdk/bin/../jre/lib/amd64;D:\java\jdk\bin;D:\java\JRE\bin;D:\ernv\gradle\gradle-6.6.1-all\gradle-6.6.1\bin;C:\sqlite3;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;d:\python\Scripts;D:\爬虫所需软件\数据库\;D:\Git\cmd;D:\bin;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;D:\MySQL\MySQL Server 5.5\bin;D:\Python;C:\Program Files\Terminus\Terminus.exe;D:\tools\myBlog\node-v12.1.0-win-x64;D:\tools\myBlog\node-v12.1.0-win-x64\node-global;D:\tools\myBlog\node-v12.1.0-win-x64\node-global\node_modules\hexo\node_modules\.bin;D:\ernv\java\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin;D:\ernv\lib\opencv\Opencv3.4.2\Opencv3.4.2\WindowSoft\opencv\build\x64\vc15\bin;I:\软件安装包\mrunit\windows系统hadoop插件-winutilsmaster\winutils-master\hadoop-2.6.3\bin;C:\Users\erbin\AppData\Local\Microsoft\WindowsApps;D:\ProGramTool\byTool\PyCharm 2018.3.2\bin;D:\爬虫所需软件\数据库\mysql-5.6.43-winx64\bin;D:\tools\Programs\Fiddler;D:\IDE\JetBrains\IDEA 2020.1\IntelliJ IDEA 2020.1\bin;C:\Users\erbin\AppData\Local\Pandoc\;D:\go\idea\GoLand 2020.1\bin;D:\eclipse-jee-neon-3-win32-x86_64\eclipse;;.
十一月 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 Proctice\java\pro\20201109\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CRMSystem\WEB-INF\classes\spring\spring-dao.xml]
十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:\Language Proctice\java\pro\20201109\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CRMSystem\WEB-INF\classes\spring\spring-mvc.xml]
十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:\Language Proctice\java\pro\20201109\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CRMSystem\WEB-INF\classes\spring\spring-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 <clinit>
信息: 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"htmlcode">
十一月 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 Proctice\java\pro\20201109\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CRMSystem\WEB-INF\classes\spring\spring-dao.xml]
十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:\Language Proctice\java\pro\20201109\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CRMSystem\WEB-INF\classes\spring\spring-mvc.xml]
十一月 13, 2020 11:56:13 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [G:\Language Proctice\java\pro\20201109\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CRMSystem\WEB-INF\classes\spring\spring-service.xml]

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

十一月 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'

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

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

一句话新闻

Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。