在学习springmvc整合mybaits是,项目启动出现下面问题:
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server.服务器版本: Apache Tomcat/7.0.103
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: 服务器构建: Mar 16 2020 08:34:15 UTC
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: 服务器版本号(:7.0.103.0
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows 10
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS.版本: 10.0
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: 架构: amd64
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java 环境变量: E:java_workstationjdk8_64jre
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM 版本: 1.8.0_202-b08
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM.供应商: Oracle Corporation
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: E:STSSts_workstation.metadata.pluginsorg.eclipse.wst.server.core mp1
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: E:Maven omcat7apache-tomcat-7.0.103
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:56147
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -javaagent:E:STSSTSsts-bundlests-3.9.6.RELEASEconfigurationorg.eclipse.osgi324 .cplibjavaagent-shaded.jar
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=E:STSSts_workstation.metadata.pluginsorg.eclipse.wst.server.core mp1
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=E:Maven omcat7apache-tomcat-7.0.103
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=E:STSSts_workstation.metadata.pluginsorg.eclipse.wst.server.core mp1wtpwebapps
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=E:Maven omcat7apache-tomcat-7.0.103endorsed
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=GBK
十月 10, 2020 12:59:32 上午 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: [E:java_workstationjdk8_64in;C:WindowsSunJavain;C:Windowssystem32;C:Windows;E:/java_workstation/jdk8_64/bin/../jre/bin/server;E:/java_workstation/jdk8_64/bin/../jre/bin;E:/java_workstation/jdk8_64/bin/../jre/lib/amd64;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:WindowsSystem32OpenSSH;c:altera90quartusin;E:Mavenapache-maven-3.6.3in;"E:java_workstationjdk8_64in;E:java_workstationjdk8_64jrein";C:Program Files
odejs;C:Program FilesGitcmd;D:learning_softwareMySqlmysql-8.0.21-winx64in;C:Program FilesMicrosoft SQL ServerClient SDKODBC170ToolsBinn;C:Program Files (x86)Microsoft SQL Server150ToolsBinn;C:Program FilesMicrosoft SQL Server150ToolsBinn;C:Program FilesMicrosoft SQL Server150DTSBinn;C:Program Files (x86)Microsoft SQL Server150DTSBinn;C:UsersFQKAppDataLocalProgramsPythonPython37Scripts;C:UsersFQKAppDataLocalProgramsPythonPython37;C:UsersFQKAppDataLocalMicrosoftWindowsApps;E:java_workstationjdk8_64in;E:pycharmpycharmPyCharm 2019.1.3in;;E:Mavenapache-maven-3.6.3in;E:program_softwareIntellij IDEAinstallIntelliJ IDEA 2019.3.3in;;C:UsersFQKAppDataRoaming
pm;C:Program FilesGitin;;E:program_softwarewebstorminstallWebStorm 2020.1.2in;;D:learning_softwarevscodeMicrosoft VS Codein;E:STSSTSsts-bundlests-3.9.6.RELEASE;;.]
十月 10, 2020 12:59:32 上午 org.apache.coyote.AbstractProtocol init
信息: 初始化协议处理器 ["http-bio-8080"]
十月 10, 2020 12:59:32 上午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 639 ms
十月 10, 2020 12:59:32 上午 org.apache.catalina.core.StandardService startInternal
信息: Starting service [Catalina]
十月 10, 2020 12:59:32 上午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.103
十月 10, 2020 12:59:33 上午 org.apache.catalina.startup.TldConfig execute
信息: 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.
十月 10, 2020 12:59:34 上午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
警告: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [688] milliseconds.
十月 10, 2020 12:59:35 上午 org.apache.catalina.startup.TldConfig execute
信息: 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.
十月 10, 2020 12:59:35 上午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
十月 10, 2020 12:59:35 上午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
十月 10, 2020 12:59:35 上午 org.apache.catalina.core.StandardContext listenerStart
严重: 异常将上下文初始化事件发送到类的侦听器实例.[org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5136)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5662)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1689)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1679)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
... 21 more
十月 10, 2020 12:59:35 上午 org.apache.catalina.core.StandardContext startInternal
严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
十月 10, 2020 12:59:35 上午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/springmvc-mybaits] startup failed due to previous errors
十月 10, 2020 12:59:35 上午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
十月 10, 2020 12:59:35 上午 org.apache.catalina.core.StandardContext listenerStop
严重: 例外情况发送上下文删除事件[org.springframework.web.context.ContextLoaderListener],以便列表实例
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:908)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:884)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5183)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5874)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1689)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1679)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
十月 10, 2020 12:59:35 上午 org.apache.coyote.AbstractProtocol start
信息: 开始协议处理句柄["http-bio-8080"]
十月 10, 2020 12:59:35 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 2401 ms
解决办法
参考文章
修改一下对应的mapper文件的namespace,如上图,重新启动,即可。