shbhmrzd
11/10/2023, 3:33 PMrust
// Create fs backend builder.
let mut builder = Hdfs::default();
// Set the name node for hdfs.
builder.name_node("hdfs://127.0.0.1:9000");
// Set the root for hdfs, all operations will happen under this root.
//
// NOTE: the root must be absolute path.
builder.root("/");
// `Accessor` provides the low level APIs, we will use `Operator` normally.
let op: Operator = Operator::new(builder)?.finish();
// Fetch metadata
let meta = op.stat("output.log").await?;
let mode = meta.mode();
let length = meta.content_length();
The code fails at operator initialization.
loadFileSystems error:
(unable to get stack trace for java.lang.NoClassDefFoundError exception: ExceptionUtils::getStackTrace error.)
hdfsBuilderConnect(forceNewInstance=0, nn=hdfs://127.0.0.1:9000, port=0, kerbTicketCachePath=(NULL), userName=(NULL)) error:
(unable to get stack trace for java.lang.NoClassDefFoundError exception: ExceptionUtils::getStackTrace error.)
Error: Unexpected (temporary) at => uncategorized error
Source:
Unknown error: 255 (os error 255)
The logs show nn as nn=hdfs://127.0.0.1:9000, port=0.
Could somebody please help if I am missing something ?Xuanwo
11/10/2023, 7:18 PMXuanwo
11/10/2023, 7:19 PMexport HADOOP_HOME=/path/to/hadoop
export LD_LIBRARY_PATH=${JAVA_HOME}/lib/server:${LD_LIBRARY_PATH}
export CLASSPATH=$(${HADOOP_HOME}/bin/hadoop classpath --glob)shbhmrzd
11/11/2023, 8:34 AMwarning: `opendal_test` (bin "opendal_test") generated 1 warning (run `cargo fix --bin "opendal_test"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.17s
Running `target/debug/opendal_test`
2023-11-11 14:01:56,288 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[1] 88885 segmentation fault cargo run
This is the code
rust
use std::sync::Arc;
use opendal::Result;
use opendal::services::Hdfs;
use opendal::Operator;
#[tokio::main]
async fn main() -> Result<()> {
// Create fs backend builder.
let mut builder = Hdfs::default();
// Set the name node for hdfs.
builder.name_node("hdfs://127.0.0.1:9000");
// Set the root for hdfs, all operations will happen under this root.
//
// NOTE: the root must be absolute path.
builder.root("/");
// `Accessor` provides the low level APIs, we will use `Operator` normally.
let op: Operator = Operator::new(builder)?.finish();
// Fetch metadata
let meta = op.stat("output.log").await?;
let mode = meta.mode();
println!("1 - {}", mode.to_string());
let length = meta.content_length();
println!("2 - {}", length);
Ok(())
}Xuanwo
11/11/2023, 8:39 AMXuanwo
11/11/2023, 8:40 AMXuanwo
11/11/2023, 8:40 AMXuanwo
11/11/2023, 8:43 AMshbhmrzd
11/11/2023, 9:00 AMXuanwo
11/11/2023, 9:00 AMXuanwo
11/11/2023, 9:01 AMXuanwo
11/11/2023, 9:02 AMshbhmrzd
11/11/2023, 9:04 AMXuanwo
11/11/2023, 9:10 AMshbhmrzd
11/11/2023, 9:12 AMXuanwo
11/11/2023, 9:12 AMXuanwo
11/11/2023, 9:13 AMshbhmrzd
11/11/2023, 9:13 AMXuanwo
11/11/2023, 9:14 AMshbhmrzd
11/12/2023, 6:49 AMshell
*[master][~/Projects/Learn/rust/opendal_test]$ ./target/debug/opendal_test
2023-11-12 12:14:36,306 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[1] 24338 segmentation fault ./target/debug/opendal_test
Attaching debug information
https://cdn.discordapp.com/attachments/1172559566924431460/1173152678390550538/message.txt?ex=6562ea92&is=65507592&hm=f78ad80eea2b78d56e69e97562284dea9f3e6016e1bed481c726cbe37f37ed12&shbhmrzd
11/12/2023, 11:10 PMXuanwo
11/13/2023, 6:22 AMXuanwo
11/13/2023, 6:46 AMXuanwo
11/13/2023, 6:46 AMshbhmrzd
11/13/2023, 12:44 PMshbhmrzd
11/13/2023, 12:51 PMXuanwo
11/13/2023, 3:55 PMXuanwo
11/13/2023, 3:56 PMXuanwo
11/13/2023, 3:58 PMhdfs-sys in deps and enable feature hdfs_3_3 to use the latest libhdfs vendor code.Xuanwo
11/13/2023, 3:58 PMXuanwo
11/13/2023, 3:58 PMshbhmrzd
11/13/2023, 5:23 PMshbhmrzd
11/13/2023, 6:02 PMshbhmrzd
11/13/2023, 6:02 PMtoml
[dependencies]
opendal = { version = "0.41.0", features = ["services-hdfs"] }
hdrs = {version="0.3.1", features = ["vendored"]}
hdfs-sys = {version="0.3.0", features = ["hdfs_3_3"]}
tokio = { version = "1", features = ["full"] }Xuanwo
11/14/2023, 6:20 AMXuanwo
11/14/2023, 6:21 AMhadoop fs ls / works?shbhmrzd
11/14/2023, 8:22 AMshbhmrzd
11/14/2023, 8:23 AMshbhmrzd
11/14/2023, 8:26 AMshbhmrzd
11/14/2023, 1:33 PM