将mapreduce代码打包扔到服务器上,运行jar,报错:
Exception in thread "main" java.lang.ClassNotFoundException: src.etl.VideoETLRunner.java
打包之前,maven需要加一个配置:
(build这块一定要配置,否则打jar的时候会说找不到主类)
(类限定名不要写错,不然执行的时候就会报异常Exception in thread “main” java.lang.ClassNotFoundException)
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.10</version>
<configuration>
<mainClass>src/etl/VideoETLRunner.java</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
</build>
mapreduce跑起来,success!
成功解决!