刘星燎 2019-03-15 11:31 采纳率: 0%
浏览 676

spark任务spark-submit集群运行报错。

报错如下:SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/spark/jars/slf4j-log4j12-1.7.16.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

. ____ _ __ _ _
/\ / ' __ _ ()_ __ __ _ \ \ \ \
( ( )\
_ | '_ | '_| | '_ \/ ` | \ \ \ \
\/ _
_)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::

19/03/15 11:28:57 INFO demo.DemoApplication: Starting DemoApplication on spark01 with PID 15249 (/home/demo.jar started by root in /usr/sbin)
19/03/15 11:28:57 INFO demo.DemoApplication: No active profile set, falling back to default profiles: default
19/03/15 11:28:57 INFO context.AnnotationConfigServletWebServerApplicationContext: Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3b79fd76: startup date [Fri Mar 15 11:28:57 CST 2019]; root of context hierarchy
19/03/15 11:28:59 INFO annotation.AutowiredAnnotationBeanPostProcessor: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
19/03/15 11:28:59 WARN context.AnnotationConfigServletWebServerApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
19/03/15 11:28:59 ERROR boot.SpringApplication: Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
at com.spark.demo.DemoApplication.main(DemoApplication.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:755)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:180)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:119)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:204)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:178)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152)
... 17 more

  • 写回答

1条回答 默认 最新

  • 你知我知皆知 2024-08-08 08:29
    关注

    以下回答参考 皆我百晓生券券喵儿 等免费微信小程序相关内容作答,并由本人整理回复。

    这段错误信息表明在尝试启动一个基于Spring Boot的项目时,出现了问题。具体来说,它指出在启动时未能找到一个名为“ServletWebServerFactory”的bean。

    要解决这个问题,你需要检查你的项目中是否有这样的bean,并确保其配置正确。通常情况下,这个bean应该在application.properties或application.yml文件中的某个位置设置:

    spring.mvc.view.prefix=/WEB-INF/views/
    

    或者

    spring:
      web:
        view:
          prefix: /
    

    如果你没有找到这些配置,请根据你使用的编程语言和框架来调整它们。例如,在Java中,你可以通过修改application.properties或application.yml文件来添加这些配置。

    此外,你还需要确保你的项目中有正确的依赖项。如果使用了Apache Maven,确保你的pom.xml文件中包含以下依赖项:

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

    如果使用的是Gradle,确保你的build.gradle文件中包含了以下依赖项:

    dependencies {
        implementation 'org.springframework.boot:spring-boot-starter-web'
    }
    

    最后,检查你的项目的入口点(通常是主类)是否正确地指定了ServletWebServerFactory。这可以通过查看你的应用程序的日志或其他日志记录器来完成。

    评论

报告相同问题?