Spring-boot与Spark不兼容问题:An attempt was made to call the method org.codehaus.commons.compiler.Location

问题场景

spring-boot程加载hdfs上spark训练好的模型,本地起spark-local方式去做预测。

软件版本

   
        org.springframework.boot
        spring-boot-starter-parent
        1.5.16.RELEASE
         
    


        
            org.springframework.boot
            spring-boot-starter-web
        
		
            org.apache.hadoop
            hadoop-client
            2.8.4<
		
	   
            org.apache.spark
            spark-mllib_2.11
            2.1.3
	

出现Bug
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-11-09 17:48:40.358 ERROR 21246 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call the method org.codehaus.commons.compiler.Location.(Ljava/lang/String;SS)V but it does not exist. Its class, org.codehaus.commons.compiler.Location, is available from the following locations:

    jar:file:/Users/AllenBai/.m2/repository/org/codehaus/janino/commons-compiler/3.0.8/commons-compiler-3.0.8.jar!/org/codehaus/commons/compiler/Location.class

It was loaded from the following location:

    file:/Users/AllenBai/.m2/repository/org/codehaus/janino/commons-compiler/3.0.8/commons-compiler-3.0.8.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.codehaus.commons.compiler.Location

解决方法

添加依赖包


        org.codehaus.janino
        commons-compiler
        2.7.8

你可能感兴趣的:(Spark,SpringBoot)