1、ERROR:No implicits found for parameter evidence$16: TypeInformation[String]
    image.png

    原因是导包错误,无法识别隐式转换
    导入 import org.apache.flink.api.scala._ 即可

    21.报错:

    1. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/scala/typeutils/CaseClassTypeInfo
    2. at java.lang.ClassLoader.defineClass1(Native Method)
    3. at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    4. at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    5. at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    6. at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    7. at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    8. at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    9. at java.security.AccessController.doPrivileged(Native Method)
    10. at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    11. at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    12. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    13. at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    14. at com.hairuo.flink.streaming.chapter1.AverageSensorReadings.main(AverageSensorReadings.scala)
    15. Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.scala.typeutils.CaseClassTypeInfo
    16. at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    17. at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    18. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    19. at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    20. ... 13 more
    21. Process finished with exit code 1

    2.错误分析:主要看这一句
    Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/flink/api/scala/typeutils/CaseClassTypeInfo
    大概意思是找不到类


    3.解决办法:
    修改pom文件中的依赖项

    <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-scala_${scala.binary.version}</artifactId>
                <version>${flink.version}</version>
                <scope>provided</scope>
            </dependency>
    

    去掉scope即可

    <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-scala_${scala.binary.version}</artifactId>
                <version>${flink.version}</version>
    <!--            <scope>provided</scope>-->
            </dependency>