.Protobuf,GRpc,Maven项目出现UnsatisfiedDependencyException、ClassNotFoundException、BuilderException等异常
异常如下:
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等异常的更多相关文章
- SpringMVC Maven项目 java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServle
今天在搭建SpringMVC开发框架时,遇到了一个问题,尽管在maven的POM.xml文件中配置了项目所依赖的jar包,但在启动项目是已然报错如下: 信息: Starting Servlet Eng ...
- maven项目导入,包名出现异常-多出一个java的前缀
maven工程导入项目的时候,整个结构出现混乱,如下图所示,包名前面莫名其妙的出现了java的前缀: 原因是导入错误,重新导入即可.
- Maven--(一个坑)在settings.xml文件中添加mirrors导致无法新建Maven项目
这是用新电脑第一次创建Maven项目--当然是一个测试项目.已经差不多忘了该怎样做,所以参考我的博客:http://www.cnblogs.com/wql025/p/4996486.html,这应该是 ...
- maven 项目启动tomcat报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
maven项目启动tomcat报错: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...
- 【转】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 ...
- maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
maven 导入项目中经常出现这个问题 严重: Error configuring application listener of class org.springframework.web.cont ...
- 部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener【转】
部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...
- maven项目在eclipse启动报错:java.lang.ClassNotFoundException
问题: 用eclipse创建maven项目的时候,pom.xml中相关的依赖jar已经导入进去,还会报java.lang.ClassNotFoundException的错误,提示找不到相关的jar包, ...
- Maven项目Eclipse启动时报错: java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
Eclipse中启动Maven项目时报如下错误: 严重: Error configuring application listener of class org.springframework.web ...
随机推荐
- 学以致用 ---- vue子组件→父组件通信
之前写过一篇关于 vue2.0中v-on绑定自定义事件 的随笔,但是今天实际应用的时候才发现根本就不理解,下面是实际工作中遇到的问题: [情景描述]页面中的[下拉搜索组件],因为多个页面中用到,所以抽 ...
- STL__size_t, ptrdiff_t, size_type, difference_type
http://blog.csdn.net/zhaowei123191/article/details/5617559 ize_t 是unsigned类型, 用于指明数组长度或下标,它必须是一个正数,s ...
- [ios]received memory warning
参考:http://blog.sina.com.cn/s/blog_68661bd80101nn6p.html IPhone下每个app可用的内存是被限制的,如果一个app使用的内存超过20M,则系统 ...
- 《剑指offer》第三十四题(二叉树中和为某一值的路径)
// 面试题34:二叉树中和为某一值的路径 // 题目:输入一棵二叉树和一个整数,打印出二叉树中结点值的和为输入整数的所 // 有路径.从树的根结点开始往下一直到叶结点所经过的结点形成一条路径. #i ...
- FastJson之JsonObject, JsonString, JavaBean,List快速转换
// 将json字符串转换为json对象 JSONObject jsonObject = JSON.parseObject(jsonStr); // {"retState":&qu ...
- Codeforces 496C - Removing Columns
496C - Removing Columns 思路:暴力,用vis标记数组实时记录一下之前的行i+1和上一行i否全相等,false表示全相等. 代码: #include<bits/stdc++ ...
- iconfont使用方法
最近才发现一种新的iconfont的使用方法 http://www.iconfont.cn/ 经常使用的图标放在一个项目里 需要关注的几点: 使用方法有三种方式unicode , font clas ...
- 雷林鹏分享:C# 集合(Collection)
C# 集合(Collection) 集合(Collection)类是专门用于数据存储和检索的类.这些类提供了对栈(stack).队列(queue).列表(list)和哈希表(hash table)的支 ...
- SQL 基础学习(2) Joining 和function , 作业没有做,需要看百宝箱。NOsql的概念
SQL 基础学习(2) Joining 可以同时关联(joining)多张表进行复杂的查询. 相比于用Rails捞出数据再用Ruby进行过滤组合,使用SQL更加高效,节能. 以下是 users has ...
- Graph (floyd)
Description Everyone knows how to calculate the shortest path in a directed graph. In fact, the oppo ...