idea 创建的maven+spring+mybatis项目整合 报错无法创建bean

最近在做一个由maven构建的spring+spring mvc+mybatis项目,刚开始的时候是用自己的电脑Win10环境下的eclipse写的,托管到了码svn上面,刚开始什么问题都没有

同学用的是win10+idea,结果问题就来了,下载下来的代码居然不能运行!!!,各种看着一脸懵逼的报错信息(idea的tomcat运行日志文件很不好找,找了好久)辛辛苦苦弄了一周左右,期间经历了把项目删了又建,然后自己搭环境等各种坑爹的环节,一开始报错信息千奇百怪,在弄了这么久之后大概就稳定成了如下的样子:

  1. mybatis.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.core.io.Resource[]' for property 'mapperLocations'; nested exception is java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:com/scpchome/dao/mapping/*.xml]: class path resource [com/scpchome/dao/mapping/] cannot be resolved to URL because it does not exist  

一直是不能创建bean的样子,经过一行一行地阅读报错信息。。最后发现mybatis的映射xml文件居然没有找到,然后又去翻classes目录,结果果然没有,知道具体的错误就好办了,随后百度了一发在pom文件中加入了如下代码,困扰了一周的问题成功解决

  1. <!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->  
  2.     <build>  
  3.         <resources>  
  4.             <resource>  
  5.                 <directory>src/main/java</directory>  
  6.                 <includes>  
  7.                     <include>**/*.properties</include>  
  8.                     <include>**/*.xml</include>  
  9.                 </includes>  
  10.                 <filtering>false</filtering>  
  11.             </resource>  
  12.         </resources>  
  13.     </build>  

时间: 2024-08-02 11:06:28

idea 创建的maven+spring+mybatis项目整合 报错无法创建bean的相关文章

resin spring mybatis-Resin 启动 Spring+Mybatis项目时报此错

问题描述 Resin 启动 Spring+Mybatis项目时报此错 (此项目之前是在tomcat上运行,并且参考网上案例已对配置做出相应调整) org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [E:workspaceSaCodewebWEB-INFclassesspringapplicationCo

java+Spring+mybatis 查询sql报错:无效的序列号!

问题描述 java+Spring+mybatis 查询sql报错:无效的序列号! java+Spring+mybatis+lucens+达梦数据库.应该能判断和数据库和lucen没关系.,着急在线等!mybatis: SELECT COUNT(*) FROM ""user_task"" title"" like '%""#{title}""%' And ""status"&qu

struts2+spring+mybatis 程序不报错,但是数据无法写入数据库

问题描述 struts2+spring+mybatis 程序不报错,但是数据无法写入数据库 执行到service 无法写入数据库,不报错.代码如下: <?xml version=""1.0"" encoding=""utf-8"" ?><!DOCTYPE mapper PUBLIC ""-//mybatis.org//DTD Mapper 3.0//EN""http:/

spring mvc-springmvc项目启动报错

问题描述 springmvc项目启动报错 报错如上 我按照网上的方法清空了 好多缓存文件之列的 但是没有用啊!! 上图自动咋生成了 spring_mvc.xml文件呢? 有没有知道的大神!!! 解决方案 后来重新试了一下 原来是 Dynastic web project 的名称命名问题 项目发布到tomcat上后 在 config/Catalina/localhost/目录下会生成和 项目名称一样的xml文件哦 错就错在我之前 给springMVC项目起名字的时候 写成了 spring MVC

急,关于项目启动报错的问题

问题描述 急,关于项目启动报错的问题 是这样的,有a,b两个分项目,b项目是主项目然后在myeclipse中b项目build path引入了a项目然后b的类中可以引入a的类,直接在java文件最上面写import就行,但是b的spring.xml无法读取到a项目的spring.xml等xml文件(就是在b的xml中import的a的xml无法连接到)启动时报错,报找不到那个a的xml的错误 解决方案 Spring MVC项目启动报错信息__待解决关于项目启动报错一些新手问题weblogic启动项

maven 整合springmvc spring myatis整合报错

问题描述 maven 整合springmvc spring myatis整合报错 java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]] at java.util.concurrent.FutureTask.

maven项目 mybatis generator运行报错。。。。在线急等!!!

问题描述 maven项目 mybatis generator运行报错....在线急等!!! 执行maven命令:mybatis-generator:generate -e 时报如下错误: Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:genera

mybatis-我在原有的项目当中按照官方的例子集成了spring websocket,没有报错,但是项目无法启动

问题描述 我在原有的项目当中按照官方的例子集成了spring websocket,没有报错,但是项目无法启动 我的项目是sring+springMVC+Mybatis,JDK为1.7,tomcat 7 按照官方的例子spring web socket demo搞了好几天了,一直是这样,有木有大神帮我看看是怎么回事 主要的代码在这里 @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends A

jar-web项目转换为maven项目,项目各种报错的问题

问题描述 web项目转换为maven项目,项目各种报错的问题 有一个比较大的web项目,原本是不支持maven的.jar包什么的 都是手动打,现在需要改成 maven来管理的.我通过右键项目configure里面的convert to Maven project之后,项目报错. 难道是我漏掉了什么地方?还是说不能直接点击convert to Maven project?请大神 错误类似于这种.提示全都是 XXX cannot be resolved to a type 解决方案 这个错误,,就是