问题场景
spring-boot程加载hdfs上spark训练好的模型,本地起spark-local方式去做预测。
软件版本
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.16.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.8.4<</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.1.3</version>
</dependency>
</dependencies>
出现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.<init>(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
解决方法
添加依赖包
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
<version>2.7.8</version>
</dependency>