今天启动用eureka的服务消费者时,一直出现问题。

SpringCloud报错:

Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

解决方案:

网上的解决方案大多如下:

1.在main()方法的启动类的上方添加注解 @SpringBootApplication

2.可能是pom.xml中缺少依赖包

   <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

这些并没有解决我的问题,检查了几个小时后,发现是我的 .class 文件名称写错了。这个错误太低级了。。

将.class名称改为与类名一致就可以了。

@SpringBootApplication
@EnableDiscoveryClient
public class EurekaConsumerApplication { public static void main(String[] args) {
new SpringApplicationBuilder(EurekaConsumerApplication.class).web(true).run(args);
}
}

SpringCloud报错:Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.的更多相关文章

  1. Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFa

    Springboot通过application启动报错 2019-01-25 14:02:33.810 ERROR [restartedMain] org.springframework.boot.S ...

  2. Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

    SpringBoot启动时的异常信息如下: "C:\Program Files\Java\jdk1.8.0_161\bin\java" ......... com.fangxing ...

  3. nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.报错解决

    近期在学springboot,学的时候遇到这个错,网上查了好多,改了不行,后来发现自己的配置类没有加@SpringBootApplication注解 Exception encountered dur ...

  4. spring Boot 出现:org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

    org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplication ...

  5. 【转载】springboot启动报错(Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWe)

    SpringBoot启动时的异常信息如下: 1 "C:\Program Files\Java\jdk1.8.0_161\bin\java" ......... com.fangxi ...

  6. springboot报错Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean

    springboot项目在启动时需要把servlet容器编译进去,这时候如果你的maven依赖里面没有配置jetty或者tomcat相关依赖就会报错. 解决方法: jetty添加 <depend ...

  7. Spring boot 报错 Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

    在实际开发中修改别人的代码,发现了这个报错,后来发现是因为pom.xml里面 只要将注释掉的部分注释掉就好了.

  8. 【spring boot】整合LCN,启动spring boot2.0.3 启动报错:Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

    spring boot 2.0.3启动报错: Error starting ApplicationContext. To display the conditions report re-run yo ...

  9. org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplic

    org.springframework.context.ApplicationContextException: Unable to start web server; nested exceptio ...

随机推荐

  1. mybatis一(常用配置信息和获取插入后id)

    <!--配置文件--><?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE conf ...

  2. PHP微信公共号H5支付。

    1.接受支付信息. /** * 发起支付请求 * @return [type] [description] */ function pay($openid){ $nonce_str = $this-& ...

  3. 功能测试-UI测试思考点

    界面是否美观 元素大小 界面元素是否对齐方式统一 界面字体属性是否正确 界面链接及触发动作( 链接的地址是否正确,不允许存在死链的情况 链接打开方式,当前页面还是新开页面 鼠标点击后的颜色是否美观,不 ...

  4. react-native启动页面设置,react-native-splash-screen

    用于解决iOS和Android启动白屏问题及简单的启动页面展示 下载 react-native-splash-screen yarn add react-native-splash-screen re ...

  5. nginx 代理跨域

    跨域 nginx设置http{ add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers X- ...

  6. Git 上传文件到 码云 gitee

    1:git bash 执行如下 git config –global user.name “eason” git config –global user.email “your email@qq.co ...

  7. Hive安装 和管理

  8. Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higher

    Context namespace element 'annotation-config' and its parser class [org.springframework.context.anno ...

  9. span标签 宽度无效解决方案

    完美的解决方案 下 面代码的CSS定义完美解决了span的宽度设置问题. 由于浏览器通常对不支持的CSS属性采取忽略处理的态度, 所以最好将display:inline -block行写在后面,这样在 ...

  10. python正则表达式查找汉字

    使用正则表达是查找汉字之前,要将所有的字符串都转码成utf8 import re string_test = "This is test string 这是测试字符串" strin ...