系统城装机大师 - 固镇县祥瑞电脑科技销售部宣传站!

当前位置:首页 > server > anz > 详细页面

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

时间:2020-11-18来源:www.pcxitongcheng.com作者:电脑系统城

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

项目运行日志如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
十一月 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? 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 已经成功接管了我的静态资源

1
2
3
十一月 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三个配置文件都已经加载进环境

1
2
3
4
5
6
十一月 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映射模型目录已经加载

1
2
3
4
十一月 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
结果是成功访问到了前端页面,解决了这个问题。

到此这篇关于关于tomcat部署应用无法访问前端页面的问题的文章就介绍到这了

分享到:

相关信息

  • Nginx主机域名配置实现

    一、配置多个端口访问不同文件 二、配置不同域名访问不同文件 三、配置不同域名访问同个文件...

    2023-03-17

  • Nginx配置-日志格式配置方式

    上线了一个小的预约程序,配置通过Nginx进行访问入口,默认的日志是没有请求时间的,因此需要配置一下,将每一次的请求的访问响应时间记录出来,备查与优化使用....

    2023-03-17

系统教程栏目

栏目热门教程

人气教程排行

站长推荐

热门系统下载