问题描述
我有一个 Jar 运行代码,它利用带有 LocalFilesystem 的 hadoop 库。此代码在 Docker 中运行并部署在远程 Kubernetes 集群上。我可以在 Docker 容器中本地运行此代码,并且运行良好。
部署时出现此错误:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.apache.hadoop.conf.Configuration.getLong(String,long)" because the return value of "org.apache.hadoop.fs.FileSystem.getConf()" is null
我以前在写入 tmp 目录时遇到此错误(甚至在本地),但在将其写入桌面时已修复。我认为这是 Hadoop 无法定位此目录位置。
我在 /compact
的根位置下的部署中添加了 PV 和 PVC,但遇到了同样的失败。
示例(jsonnet 中的 k8 部署规范)
volumeMounts: [
{
mountPath: '/tmp',name: 'tmp',},{
mountPath: '/compact',name: 'compactorpvc',],env: podenv(app.name),volumes: [
{
name: 'tmp',emptyDir: {},{
name: 'compactorpvc',persistentVolumeClaim: {
claimName: 'compactorpvc'
},
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)