关于tomcat部署应用无法访问前端页面的问题
程序员文章站
2022-03-14 20:16:50
最近在做实训项目的时候使用到了 ssm框架,在项目环境搭建好后,运行程序时,一直遇到页面访问404错误。项目运行日志如下:十一月 13, 2020 11:56:07 上午 org.apache.cat...
最近在做实训项目的时候使用到了 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\*\*.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 已经成功接管了我的静态资源
十一月 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。
结果是成功访问到了前端页面,解决了这个问题。
到此这篇关于关于tomcat部署应用无法访问前端页面的问题的文章就介绍到这了,更多相关tomcat部署无法访问页面内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!