当我想将 ResultScanner 对象写入磁盘时,我遇到了这个错误:
Exception in thread "main" java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.hadoop.hbase.client.ClientScanner
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1988)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1795)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at cache1.CacheManager.getCache(CacheManager.java:112)
at cache1.Cache1.main(Cache1.java:43)
Caused by: java.io.NotSerializableException: org.apache.hadoop.hbase.client.ClientScanner
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at cache1.CacheManager.putCache(CacheManager.java:102)
at cache1.Cache1.main(Cache1.java:41)
据我所知,问题在于 ResultScanner (ClientScanner) 不可序列化。由于我无权访问此类,我该如何解决这个序列化问题?或者有没有其他方法可以将此对象存储到文件中?