springboot启动问题集合

文章目录

    • APPLICATION FAILED TO START
    • 未扫描到路径
    • dubbo
      • dubbo超时
      • dubbo传输数据限制
      • dubbo思考
      • dubbo依赖注入的service为null
      • @Reference 引用错误
      • 本地起两个dubbo,debug进入jar包中
    • 服务者未启动
    • 继承Serializable或者改为json传输
    • pom引用报错
      • tips
    • pom不生效
    • NoSuchMethodError通用思路
    • 启动失败Error creating bean with name 'projectOrderController'

APPLICATION FAILED TO START

***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'com.lsh.demo.basic.strategy.PayService' that could not be found.
Action:
Consider defining a bean of type 'com.lsh.demo.basic.strategy.PayService' in your configuration.
Process finished with exit code 1
  1. application未扫描到包路径? – 修改了包名,而忘记同步 @ComponentScan
    springboot启动问题集合_第1张图片

未扫描到路径

15:38:38.549 logback [main] WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - 
Exception encountered during context initialization - 
cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectOrderController': 
Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.lsh.demo.bootstone.workorder.ProjectOrderService' available: 
expected at least 1 bean which qualifies as autowire candidate.
Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}

解决:@ComponentScan 加上该类路径,OK

@ComponentScan(basePackages = {"com.demo.xxx.xxx"})

@ComponentScan 添加包时,如果不能识别其他module的包,检查pom文件是否引入
分析:springboot默认扫描规则:自动扫描启动器类的同包或者其子包的下的注解

dubbo

dubbo超时

com.alibaba.dubbo.remoting.TimeoutException: Waiting server-side response timeout
springboot启动问题集合_第2张图片

dubbo传输数据限制

com.alibaba.dubbo.remoting.RemotingException: Data length too large: 16368165, max payload: 8388608, channel: NettyChannel [channel=[id: 0x394cdb88, /10.63.101.xxx:64441 => /10.63.101.xx:20880]]
超过dubbo限制 – 默认是8M
springboot启动问题集合_第3张图片

dubbo思考

传输大文件效率
多种格式不支持等等

解惑:1.下载改为返回前端url自行下载
2.dubbo中的 hessian
3.oss中有专门的处理大文件方式-分片上传和断点续传
https://help.aliyun.com/document_detail/31850.html?spm=a2c4g.11186623.2.11.7a1c7815Ez0PRo#concept-wzs-2gb-5db

dubbo依赖注入的service为null

@Reference 引用错误

@Reference 必须是 com.alibaba.dubbo.config.annotation.Reference ,引用错误
重名的有 :jdk.nashorn.internal.ir.annotations.Reference

本地起两个dubbo,debug进入jar包中

通过idea可以选择

服务者未启动

Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.fliggy.xx.client.service.WorkOrderService. No provider available for the service com.fliggy.xx.client.service.WorkOrderService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=bootstone&dubbo=2.6.2&interface=com.fliggy.xx.client.service.WorkOrderService&methods=deleteFile,uploadFile,addReamrk,queryEquProducer,downloadPhoto,getWorkOrderList,uniteQuery,addContact,queryWorkOrderById,uploadPhoto,downloadFile,updateStatus,uniteUpdateOrder&pid=12880®ister.ip=10.63.101.xx&revision=1.0.0-SNAPSHOT&side=consumer×tamp=1550114181298 to the consumer 10.63.101.xx use dubbo version 2.6.2

继承Serializable或者改为json传输

java.lang.RuntimeException: Serialized class com.fliggy.xx.domain.query.MultiVO must implement java.io.Serializable
Java field: private java.util.List com.fliggy.xx.domain.query.MultiConQueryImpWorkOrderVO.multiVOS
Java field: private java.lang.Object com.alibaba.jv.framework.domain.ResultDO.module
实现Serial接口

pom引用报错

tips

提供dubbo给第三方使用时,最好在本地,新建一个项目 + 新建maven 仓库来测试
springboot启动问题集合_第4张图片
1、查看maven仓库,jar都存在,删除重新下载试试
报错信息:

Failed to read artifact descriptor for com.fliggy.xxx-client:jar:1.0.0-SNAPSHOT Failed to read artifact descriptor for com.fliggy.xxx-domain:jar:1.0.0-SNAPSHOT Failed to read artifact descriptor for com.fliggy.xxx-client:jar:1.0.0-SNAPSHOT less... (Ctrl+F1) 
Inspection info: Inspects a Maven model for resolution problems.

2、通过本地 project structure 引入本地的jar,能使得项目中不报错,但是install 找不到包,项目也无法启动
3、pom文件补全引用,install报错:

[ERROR] Failed to execute goal on project bootstone-web: Could not resolve dependencies for project com.lsh.demo:bootstone-web:war:1.1.1-SNAPSHOT: Failed to collect dependencies at com.fliggy.jvopf:jvopf-domain:jar:1.0.0-SNAPSHOT: Failed to read artifact descriptor for com.fliggy.jvopf:jvopf-domain:jar:1.0.0-SNAPSHOT: Failure to find com.fliggy.jvopf:jvopf:pom:1.0.0-SNAPSHOT in http://116.62.8.239:8082/repository/3rd-party-snapshot/ was cached in the local repository, resolution will not be reattempted until the update interval of tbmirror-snapshots has elapsed or updates are forced -> [Help 1]

4、可能是子pom修改了版本号,父工程没更新?
暂时回退0.0.1版本

pom不生效

上传jar通过指定pom解决

mvn deploy:deploy-file -Dfile=xx-xx-1.0.0-SNAPSHOT.jar -DgroupId=com.xx.xx -DartifactId=boot-stone -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -Durl=http://xx:8082/repository/3rd-party-snapshot -DrepositoryId=sf -sD:/software/apache-maven-3.5.0-bin/apache-maven-3.5.0/conf/settings_rdc.xml -DpomFile=pom.xml

springboot启动问题集合_第5张图片

springboot启动问题集合_第6张图片

springboot启动问题集合_第7张图片

springboot启动问题集合_第8张图片


springboot启动问题集合_第9张图片

–成功,不需要指定D盘
mvn deploy:deploy-file -Dfile=xx-xx-1.0.0-SNAPSHOT.jar -DgroupId=com.xx.xx-DartifactId=xx-xx-Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -Durl=http://xx:8082/repository/3rd-party-snapshot -DrepositoryId=sf -sD:/software/apache-maven-3.5.0-bin/apache-maven-3.5.0/conf/settings_rdc.xml -DpomFile=pom.xml

springboot启动问题集合_第10张图片

NoSuchMethodError通用思路

NoSuchMethodError 一般多为jar冲突,debug断点进去,或者全局搜索是否有重名类
Caused by: java.lang.NoSuchMethodError: com.alibaba.dubbo.common.utils.ConfigUtils.getSystemProperty(Ljava/lang/String;)Ljava/lang/String;
在这里插入图片描述
springboot启动问题集合_第11张图片
2019年2月18日复现:
!! hsf 包中重名类 方法 冲突!!springboot启动问题集合_第12张图片

启动失败Error creating bean with name ‘projectOrderController’

放开注释的pom文件即可,引用了本地的jar,但是pom文件还是需求

youcan
14:41:35.918 logback [main] WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectOrderController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectOrderService' defined in file [D:\MySpringBoot\bootstone\bootstone-dubbo-consumer\target\classes\com\lsh\demo\bootstone\workorder\ProjectOrderService.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.lsh.demo.bootstone.workorder.ProjectOrderService] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
14:41:35.919 logback [main] INFO  c.a.d.c.s.b.f.a.ReferenceAnnotationBeanPostProcessor - class com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor was destroying!
Disconnected from the target VM, address: '127.0.0.1:61599', transport: 'socket'

Process finished with exit code 1

1、@service换@compent 无用
2、加 @lazy 无用
3、clean install 暴露问题
springboot启动问题集合_第13张图片

问题变为 本地引入的jar,install依然报错找不到类
1、加上pom文件来测试,ok

你可能感兴趣的:(springboot启动问题集合)