Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java:导入时类中的接口不可访问_Java_Apache Spark_Import_Hive_Classloader - Fatal编程技术网

Java:导入时类中的接口不可访问

Java:导入时类中的接口不可访问,java,apache-spark,import,hive,classloader,Java,Apache Spark,Import,Hive,Classloader,我在我的程序中使用maven依赖性配置单元hcatalog核心 这个jar出现在项目maven依赖项中,接口如图1所示 接口ICacheableMetaStoreClient虽然存在于类中,但无法从import org.apache.hive.hcatalog.common解析。图像-底部 因此,在执行spark提交时,我遇到了一个例外: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.Illega

我在我的程序中使用maven依赖性配置单元hcatalog核心

这个jar出现在项目maven依赖项中,接口如图1所示

接口ICacheableMetaStoreClient虽然存在于类中,但无法从import org.apache.hive.hcatalog.common解析。图像-底部 因此,在执行spark提交时,我遇到了一个例外:

com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException:接口 org.apache.hive.hcatalog.common.HiveClientCache$ICacheableMetaStoreClient 在类加载器中不可见

我需要做什么才能从程序类路径中看到它。

让我们看看代码:

class HiveClientCache {..}
HiveClientCache只有包级别的可见性,并且它与iCacheAbleMetaStoreClient一起将无法在代码中包含的包之外进行导入

现在让我们看看iCachableMetaStoreClient:

该接口是公共的,但其上有注释,使Hive/Hadoop进行额外的预处理以检查对象类型并抛出IllegalArgumentException

以下是InterfaceAudience的JavaDoc:

注释以通知用户包、类或方法的预期用途 观众目前观众可以是InterfaceAudience.Public, InterfaceAudience.LimitedPrivate或InterfaceAudience.Private。全部的 公共类必须具有InterfaceAudience注释

默认情况下,未标记此注释的公共类必须视为InterfaceAudience.Private。 外部应用程序只能使用标记为InterfaceAudience.Public的类。避免像这样使用非公共类 类可以以不兼容的方式删除或更改。 Hadoop项目只能使用标记为InterfaceAudience.LimitedPrivate或InterfaceAudience.Public的类 方法可能有不同的注释,与类的受众分类相比,它更具限制性。示例:一个类 可能是InterfaceAudience.Public,但方法可能是 interfaceeaudience.LimitedPrivate
您知道内部类是否具有public的可见性吗?如果没有,这就解释了为什么它不可见。内部类与其他类不同,不是公共类。在这种情况下,有没有办法访问这个类
@InterfaceAudience.Private
public interface ICacheableMetaStoreClient extends IMetaStoreClient {....}