• spark Structured报错解决


    报错,不想看原因的直接去解决方案试试

    Exception in thread "main" java.lang.IllegalArgumentException: Pathname /C:/Users/Administrator/AppData/Local/Temp/1/temporary-611514af-8dc5-4b20-9237-e5f2d21fdf88/metadata from hdfs://master:8020/C:/Users/Administrator/AppData/Local/Temp/1/temporary-611514af-8dc5-4b20-9237-e5f2d21fdf88/metadata is not a valid DFS filename.
    	at org.apache.hadoop.hdfs.DistributedFileSystem.getPathName(DistributedFileSystem.java:197)
    	at org.apache.hadoop.hdfs.DistributedFileSystem.access$000(DistributedFileSystem.java:106)
    	at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1305)
    	at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1301)
    	at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
    	at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1317)
    	at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1426)
    	at org.apache.spark.sql.execution.streaming.StreamMetadata$.read(StreamMetadata.scala:51)
    	at org.apache.spark.sql.execution.streaming.StreamExecution.<init>(StreamExecution.scala:122)
    	at org.apache.spark.sql.execution.streaming.MicroBatchExecution.<init>(MicroBatchExecution.scala:49)
    	at org.apache.spark.sql.streaming.StreamingQueryManager.createQuery(StreamingQueryManager.scala:258)
    	at org.apache.spark.sql.streaming.StreamingQueryManager.startQuery(StreamingQueryManager.scala:299)
    	at org.apache.spark.sql.streaming.DataStreamWriter.start(DataStreamWriter.scala:296)
    	at com.gugu.book.basespark.chapter08.StructuredNetworkWordCount$.main(StructuredNetworkWordCount.scala:25)
    	at com.gugu.book.basespark.chapter08.StructuredNetworkWordCount.main(StructuredNetworkWordCount.scala)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    看报错信息好像是要赋权,路径不存在,但是这个路径有点古怪
    
    • 1

    hdfs://master:8020/C:/Users/Administrator/AppData/Local/Temp/1/temporary-611514af-8dc5-4b20-9237-e5f2d21fdf88/metadata is not a valid DFS filename

    按道理不应该出现C:/。。。。这个是我本地的一个地址,但是却拼接到了hdfs文件系统下,应该是什么配置的有问题
    顺着报错信息

    在这里插入图片描述
    只需要checkpointRoot修改就行这个地址来源于checkpointLocation
    org.apache.spark.sql.streaming.StreamingQueryManager#createQuery
    在这里插入图片描述

    也就是说直接改变“checkpointLocation”的值就行

    解决方案

    在start之前设置

                .option("checkpointLocation", "file:///D:\\applicationfiles\\data\\kafka")
    
    • 1

    在这里插入图片描述
    解决,完美
    环境问题,在windows下有些默认位置拼接到了hdfs上

  • 相关阅读:
    麒麟V10系统打包Qt免安装包程序
    MATLAB算法实战应用案例精讲-【目标检测】YOLOV8
    JavaScript基础07——变量拓展-数组
    批量上传图片
    Java框架 MyBatis的各种查询功能
    含文档+PPT+源码等]精品微信小程序预约挂号小程序+后台管理系统|前后分离VUE[包运行成功]程序设计源码计算机毕设
    C++特性——引用与指针详解
    json-server -v 文件名、目录名或卷标语法不正确。
    电脑提示iutils.dll丢失的解决方法,分享5种靠谱的解决方法
    代码随想录——分割回文串 II
  • 原文地址:https://blog.csdn.net/zhazhagu/article/details/133186625