报了一个异常,一直无法找到哪里出错了

报了一个异常,一直无法找到哪里出错了

容器加载中...

java.io.IOException: Could not find resource mybatis-config.xml

at org.apache.ibatis.io.Resources.getResourceAsStream(Resources.java:114)

at org.apache.ibatis.io.Resources.getResourceAsStream(Resources.java:100)

at com.damu.utils.SqlSessionFactoryUtils.initSqlSessionFactory(SqlSessionFactoryUtils.java:25)

at com.damu.listener.InitSqlSessionListener.contextInitialized(InitSqlSessionListener.java:18)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4770)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:744)

at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1730)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)

at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)

at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)

at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:483)

at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:432)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)

at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)

at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)

at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)

at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)

at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)

at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)

at java.security.AccessController.doPrivileged(Native Method)

at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408)

at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)

at sun.rmi.transport.Transport$1.run(Transport.java:200)

at sun.rmi.transport.Transport$1.run(Transport.java:197)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:196)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)

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)

[2019-07-07 03:52:45,098] Artifact mybatis-pro:war exploded: Artifact is deployed successfully

[2019-07-07 03:52:45,098] Artifact mybatis-pro:war exploded: Deploy took 669 milliseconds

07-Jul-2019 15:52:54.004 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\Tomcat\apache-tomcat-8.5.41-windows-x64\apache-tomcat-8.5.41\webapps\manager]

07-Jul-2019 15:52:54.106 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\Tomcat\apache-tomcat-8.5.41-windows-x64\apache-tomcat-8.5.41\webapps\manager] has finished in [101] ms


正在回答

登陆购买课程后可参与讨论,去登陆

2回答

同学你好,


原因可能是因为配置文件没有加载上,问一下同学将mybatis-config.xml转移到resources目录中了吗?


如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

  • litter_ 提问者 #1
    转了啊,一直都在,一个小问题整整一下午都没解决,各种出错,有点崩溃
    2019-07-07 19:07:02
  • 好帮手慕珊 回复 提问者 litter_ #2
    同学,你好!程序开发中确实会遇到各种不好解决的问题,不要着急。如果确认mybatis-config.xml在resources目录下,可以看一下项目的Target目录下是否有mybatis-config.xml文件。Target是项目发布的目录,有的时候会发生文件没有发布成功的情况,就会找不到。如果Target目录下没有该文件,可以直接拷贝一个放过去。如果还有问题,建议将项目的目录结构贴出来。祝学习愉快!
    2019-07-08 09:41:26
吃吃吃鱼的猫 2019-07-07 16:03:48

同学你好,


首先检查路径是否正确,如果路径确认正确无误,则有可能是以下原因:

情况一:

配置文件没有加载上,mybatis-config.xml中的配置文件没有加载上,配置文件是不是放在了文件夹中没有被idea默认加载,所以报错。

如果是这样的原因最简单的解决方案就是将你的mybatis-config.xml从你的文件夹中转移到resources中,这样idea会默认加载。


情况二

mybatis-config.xml文件中配置错误。

如果是这种情况,同学可以检查下配置文件是否有细节错误哦~


如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

  • 提问者 litter_ #1
    服务器无法开启,点击调试按钮后监听器显示先初始化全局监听器,然后就马上进行销毁操作了,该怎么解决?
    2019-07-07 18:24:19
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师