异常如下:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-11-21 18:13:43.282 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'approvalRecordRpc' defined in file [F:\Demo\workspase\Products\product-provider\target\classes\cn\vpclub\easywork\product\provider\rpc\ApprovalRecordRpc.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'approvalRecordServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'approvalRecordMapper' defined in file [F:\Demo\workspase\Products\product-provider\target\classes\cn\vpclub\easywork\product\provider\mapper\ApprovalRecordMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mybatisSqlSessionFactoryBean' defined in class path resource [cn/vpclub/spring/boot/mybatisplus/autoconfigure/DatasourceConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [F:\Demo\workspase\Products\product-provider\target\classes\cn\vpclub\easywork\product\provider\mapper\xml\ApprovalRecordMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'cn.vpclub.moses.product.provider.entity.ApprovalRecord'. Cause: java.lang.ClassNotFoundException: Cannot find class: cn.vpclub.moses.product.provider.entity.ApprovalRecord
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at cn.vpclub.easywork.product.provider.ProviderApplication.main(ProviderApplication.java:15)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'approvalRecordServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'approvalRecordMapper' defined in file [F:\Demo\workspase\Products\product-provider\target\classes\cn\vpclub\easywork\product\provider\mapper\ApprovalRecordMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mybatisSqlSessionFactoryBean' defined in class path resource [cn/vpclub/spring/boot/mybatisplus/autoconfigure/DatasourceConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [F:\Demo\workspase\Products\product-provider\target\classes\cn\vpclub\easywork\product\provider\mapper\xml\ApprovalRecordMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'cn.vpclub.moses.product.provider.entity.ApprovalRecord'. Cause: java.lang.ClassNotFoundException: Cannot find class: cn.vpclub.moses.product.provider.entity.ApprovalRecord
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
... 17 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'approvalRecordMapper' defined in file [F:\Demo\workspase\Products\product-provider\target\classes\cn\vpclub\easywork\product\provider\mapper\ApprovalRecordMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mybatisSqlSessionFactoryBean' defined in class path resource [cn/vpclub/spring/boot/mybatisplus/autoconfigure/DatasourceConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [F:\Demo\workspase\Products\product-provider\target\classes\cn\vpclub\easywork\product\provider\mapper\xml\ApprovalRecordMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'cn.vpclub.moses.product.provider.entity.ApprovalRecord'. Cause: java.lang.ClassNotFoundException: Cannot find class: cn.vpclub.moses.product.provider.entity.ApprovalRecord
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1357)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1249)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
... 31 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mybatisSqlSessionFactoryBean' defined in class path resource [cn/vpclub/spring/boot/mybatisplus/autoconfigure/DatasourceConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [F:\Demo\workspase\Products\product-provider\target\classes\cn\vpclub\easywork\product\provider\mapper\xml\ApprovalRecordMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'cn.vpclub.moses.product.provider.entity.ApprovalRecord'. Cause: java.lang.ClassNotFoundException: Cannot find class: cn.vpclub.moses.product.provider.entity.ApprovalRecord
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1342)
... 42 common frames omitted
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [F:\Demo\workspase\Products\product-provider\target\classes\cn\vpclub\easywork\product\provider\mapper\xml\ApprovalRecordMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'cn.vpclub.moses.product.provider.entity.ApprovalRecord'. Cause: java.lang.ClassNotFoundException: Cannot find class: cn.vpclub.moses.product.provider.entity.ApprovalRecord
at com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:574)
at com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean.afterPropertiesSet(MybatisSqlSessionFactoryBean.java:406)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 52 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'cn.vpclub.moses.product.provider.entity.ApprovalRecord'. Cause: java.lang.ClassNotFoundException: Cannot find class: cn.vpclub.moses.product.provider.entity.ApprovalRecord
at com.baomidou.mybatisplus.MybatisXMLMapperBuilder.configurationElement(MybatisXMLMapperBuilder.java:138)
at com.baomidou.mybatisplus.MybatisXMLMapperBuilder.parse(MybatisXMLMapperBuilder.java:111)
at com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:572)
... 55 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'cn.vpclub.moses.product.provider.entity.ApprovalRecord'. Cause: java.lang.ClassNotFoundException: Cannot find class: cn.vpclub.moses.product.provider.entity.ApprovalRecord
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)
at com.baomidou.mybatisplus.MybatisXMLMapperBuilder.resultMapElement(MybatisXMLMapperBuilder.java:285)
at com.baomidou.mybatisplus.MybatisXMLMapperBuilder.resultMapElement(MybatisXMLMapperBuilder.java:274)
at com.baomidou.mybatisplus.MybatisXMLMapperBuilder.resultMapElements(MybatisXMLMapperBuilder.java:266)
at com.baomidou.mybatisplus.MybatisXMLMapperBuilder.configurationElement(MybatisXMLMapperBuilder.java:134)
... 57 common frames omitted
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'cn.vpclub.moses.product.provider.entity.ApprovalRecord'. Cause: java.lang.ClassNotFoundException: Cannot find class: cn.vpclub.moses.product.provider.entity.ApprovalRecord
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)
at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)
... 61 common frames omitted
Caused by: java.lang.ClassNotFoundException: Cannot find class: cn.vpclub.moses.product.provider.entity.ApprovalRecord
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200)
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)
at org.apache.ibatis.io.Resources.classForName(Resources.java:261)
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116)
... 63 common frames omitted

解决办法:

由异常可知,所有的错误都跟ApprovalRecord类相关,根据错误提示,找不到cn.vpclub.moses.product.provider.entity.ApprovalRecord,问题在于我的项目是在cn.vpclub.easywork..下面。故此分析是在复制代码的时候,包的问题没解决。仔细寻找一遍,发现两处错误,一处是在ApprovalRecord的proto配置里面,指定包名出错。

一处是在Mapper.xml中

此两处错误导致编译不通过,报错,将错误处改正过来,就解决了

分析:此类错误多是配置和包名亦或是自动生成代码时数据库异常导致,根据问题提示,到具体地方查看,总能会有所发现

.Protobuf,GRpc,Maven项目出现UnsatisfiedDependencyException、ClassNotFoundException、BuilderException等异常的更多相关文章

  1. SpringMVC Maven项目 java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServle

    今天在搭建SpringMVC开发框架时,遇到了一个问题,尽管在maven的POM.xml文件中配置了项目所依赖的jar包,但在启动项目是已然报错如下: 信息: Starting Servlet Eng ...

  2. maven项目导入,包名出现异常-多出一个java的前缀

    maven工程导入项目的时候,整个结构出现混乱,如下图所示,包名前面莫名其妙的出现了java的前缀: 原因是导入错误,重新导入即可.

  3. Maven--(一个坑)在settings.xml文件中添加mirrors导致无法新建Maven项目

    这是用新电脑第一次创建Maven项目--当然是一个测试项目.已经差不多忘了该怎样做,所以参考我的博客:http://www.cnblogs.com/wql025/p/4996486.html,这应该是 ...

  4. maven 项目启动tomcat报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    maven项目启动tomcat报错: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...

  5. 【转】maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    http://blessht.iteye.com/blog/1104450 http://www.cnblogs.com/zhouyalei/archive/2011/11/30/2268606.ht ...

  6. maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    maven 导入项目中经常出现这个问题 严重: Error configuring application listener of class org.springframework.web.cont ...

  7. 部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener【转】

    部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...

  8. maven项目在eclipse启动报错:java.lang.ClassNotFoundException

    问题: 用eclipse创建maven项目的时候,pom.xml中相关的依赖jar已经导入进去,还会报java.lang.ClassNotFoundException的错误,提示找不到相关的jar包, ...

  9. Maven项目Eclipse启动时报错: java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener

    Eclipse中启动Maven项目时报如下错误: 严重: Error configuring application listener of class org.springframework.web ...

随机推荐

  1. django视图函数及快捷方式

    视图函数,简称视图,本质上是一个简单的Python函数,它接受Web请求并且返回Web响应. 响应的内容可以是HTML网页.重定向.404错误,XML文档或图像等任何东西.但是,无论视图本身是个什么处 ...

  2. Java成神之路技术整理

    关于 Java 的技术干货,从以下几个方面汇总. Java 基础篇 Java 集合篇 Java 多线程篇 Java JVM篇 Java 进阶篇 Java 新特性篇 Java 工具篇 Java 书籍篇 ...

  3. 《剑指offer》第三十七题(序列化二叉树)

    // 面试题37:序列化二叉树 // 题目:请实现两个函数,分别用来序列化和反序列化二叉树. #include "BinaryTree.h" #include <iostre ...

  4. php 四种基础排序

    1. 冒泡排序算法 *     思路分析:法如其名,就是像冒泡一样,每次从数组当中 冒一个最大的数出来.  *     比如:2,4,1    // 第一次 冒出的泡是4  *             ...

  5. Ubuntu 的 desktop 和 server 还是有区别。

    除了安装的包,比如 GUI, LAMP 上有差别之外,所用的内核也稍有不一样. 不过desktop可以通过安装 sudo apt-get install linux-image-server 之后,编 ...

  6. English trip -- VC(情景课)1 B Countries

    Vocabulary focus 核心词汇 Vo ca bu la ry   fo cus [və(ʊ)'kæbjʊlərɪ]      ['fəʊkəs] Listen and repeat  听并 ...

  7. python-day71--django多表操作

    表关系: 1 一对多 2 多对多 3 一对一 添加记录: 一对多:书与出版社 #创建一对多: publish=models.ForeignKey("Publish") 注意:pub ...

  8. Ubuntu解压缩zip,tar,tar.gz,tar.bz2文件命令

    tar解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName .gz解压1:gunzip FileName.gz解压2:gzip -d FileN ...

  9. nyoj860(01变形)

    http://acm.nyist.net/JudgeOnline/problem.php?pid=860 又见01背包 时间限制:1000 ms  |  内存限制:65535 KB 难度:3   描述 ...

  10. HDU-3506 Monkey Party (环形石子合并)

    题目大意:n堆石子围成一圈,每堆石子的块数已知,每次可以将相邻的两堆合并到一堆,块数变为两堆之和,代价也为两堆石子块数之和.求合并到一堆的最小代价. 题目分析:先通过将前n-1依次个移到第n个后面,将 ...