码迷,mamicode.com
首页 > 其他好文 > 详细

微服务issue记录

时间:2021-03-01 13:58:00      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:config   ons   exce   org   tap   provider   group   存在   end   

1. Cannot determine embedded database driver class for database type NONE

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})

2. \target\classes\META-INF\MANIFEST.MF (系统找不到指定的路径)
找到eclipse的project菜单选择clean...选项, clean完后即可解决


3.[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project consumer-demo: Compilation failure: Compilation failure:
[ERROR] /E:/workspace/newJavaSpace/cloud-demo/consumer-demo/src/main/java/com/kai/cloud/controller/Consumer_CustInfoController.java:[9,26] 程序包com.kai.cloud.pojo不存在
[ERROR] /E:/workspace/newJavaSpace/cloud-demo/consumer-demo/src/main/java/com/kai/cloud/controller/Consumer_CustInfoController.java:[23,16] 找不到符号
[ERROR] 符号: 类 CustInfo
[ERROR] 位置: 类 com.kai.cloud.controller.Consumer_CustInfoController
原因:
打包编译时,会生成普通jar和可执行jar,可执行jar会覆盖普通jar,而工程无法依赖可执行jar,所以报程序包com.kai.cloud.pojo不存在
解决:
在common中pom.xml加
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
</plugins>
</build>


4.java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes [Generic bean: class [com.kai.cloud.Provider_StartSpringCloudApp]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [E:\workspace\newJavaSpace\cloud-demo\provider-demo\target\classes\com\kai\cloud\Provider_StartSpringCloudApp.class], Generic bean: class [com.kai.cloud.CommonApplication]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [E:\workspace\newJavaSpace\cloud-demo\common\target\classes\com\kai\cloud\CommonApplication.class]]
单元测试时引用了common,但common中也有启动类@SpringBootApplication,
在项目中有两个@SpringBootApplication,注释掉一个你不用的就可以。

 

5.访问http://127.0.0.1/hystrix.stream时404

在configuration中加上:
@Bean
public ServletRegistrationBean getServlet() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;

}

 

微服务issue记录

标签:config   ons   exce   org   tap   provider   group   存在   end   

原文地址:https://www.cnblogs.com/MYQY520/p/14459487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!