工作问题7:Phoenix Ticket Client方式使用UDF函数出现的问题

Phoenix Ticket Client方式使用UDF函数出现的问题

问题描述

java.sql.SQLException: java.lang.reflect.InvocationTargetException
        at org.apache.phoenix.parse.FunctionParseNode.create(FunctionParseNode.java:280)
        at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:336)
        at org.apache.phoenix.compile.ProjectionCompiler$SelectClauseVisitor.visitLeave(ProjectionCompiler.java:700)
        at org.apache.phoenix.compile.ProjectionCompiler$SelectClauseVisitor.visitLeave(ProjectionCompiler.java:585)
        at org.apache.phoenix.parse.FunctionParseNode.accept(FunctionParseNode.java:86)
        at org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:412)
        at org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:561)
        at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:507)
        at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
        at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:153)
        at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:490)
        at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:456)
        at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:302)
        at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
        at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
        at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
        at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
        at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1830)
        at sqlline.Commands.execute(Commands.java:822)
        at sqlline.Commands.sql(Commands.java:732)
        at sqlline.SqlLine.dispatch(SqlLine.java:813)
        at sqlline.SqlLine.begin(SqlLine.java:686)
        at sqlline.SqlLine.start(SqlLine.java:398)
        at sqlline.SqlLine.main(SqlLine.java:291)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.apache.phoenix.parse.FunctionParseNode.create(FunctionParseNode.java:268)
        ... 23 more
Caused by: java.lang.RuntimeException: java.lang.SecurityException: Loading jars from hdfs://192.168.75.200:9000/hbase/lib/hidataUdf-0.0.1.jar is not allowed. The only location that is allowed is hdfs://node1:9009/hbase/lib
        at org.apache.phoenix.expression.function.UDFExpression.constructUDFFunction(UDFExpression.java:170)
        at org.apache.phoenix.expression.function.UDFExpression.<init>(UDFExpression.java:72)
        ... 28 more
Caused by: java.lang.SecurityException: Loading jars from hdfs://192.168.75.200:9000/hbase/lib/hidataUdf-0.0.1.jar is not allowed. The only location that is allowed is hdfs://node1:9009/hbase/lib
        at org.apache.phoenix.expression.function.UDFExpression.getClassLoader(UDFExpression.java:201)
        at org.apache.phoenix.expression.function.UDFExpression.constructUDFFunction(UDFExpression.java:163)
        ... 29 more

出现这个问题的原因是由于,定义UDF函数的时候,指定的jar包路径和hdfs-site.xml中配置的路径不一致

解决方案

将路径更改为一致
注:1.使用ticket client方式需要将hdfs-site.xml放在类路径下面,否则会读取默认的hdfs-site.xml文件,导致执行UDF函数失败。

可参考这个帖子:https://blog.csdn.net/gucapg/article/details/85999067

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值