You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "wujinhu (JIRA)" <ji...@apache.org> on 2018/11/27 13:32:00 UTC
[jira] [Updated] (HADOOP-15953) AliyunOSS: exception will be thrown
if configure fs.oss.credentials.provider to AliyunCredentialsProvider
[ https://issues.apache.org/jira/browse/HADOOP-15953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
wujinhu updated HADOOP-15953:
-----------------------------
Description:
Hadoop aliyun module uses AliyunCredentialsProvider as default CredentialsProvider if user do not set fs.oss.credentials.provider. However, if user set fs.oss.credentials.provider to org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider, exception will be thrown like below:
{code:java}
java.io.IOException: org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider constructor exception. A class specified in fs.oss.credentials.provider must provide an accessible constructor accepting URI and Configuration, or an accessible default constructor.
at org.apache.hadoop.fs.aliyun.oss.AliyunOSSUtils.getCredentialsProvider(AliyunOSSUtils.java:131)
at org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystemStore.initialize(AliyunOSSFileSystemStore.java:154)
at org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem.initialize(AliyunOSSFileSystem.java:344)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3302)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:124)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:3351)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:3319)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:479)
at org.apache.hadoop.fs.contract.AbstractBondedFSContract.init(AbstractBondedFSContract.java:72)
at org.apache.hadoop.fs.contract.AbstractFSContractTestBase.setup(AbstractFSContractTestBase.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoSuchMethodException: org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.getDeclaredConstructor(Class.java:2178)
at org.apache.hadoop.fs.aliyun.oss.AliyunOSSUtils.getCredentialsProvider(AliyunOSSUtils.java:125)
... 23 more
{code}
Because AliyunCredentialsProvider does not have corresponding constructor.
{code:java}
public class AliyunCredentialsProvider implements CredentialsProvider {
private Credentials credentials = null;
public AliyunCredentialsProvider(Configuration conf) throws IOException {
--------------------------------------------------
String className = conf.getTrimmed(CREDENTIALS_PROVIDER_KEY);
if (StringUtils.isEmpty(className)) {
Configuration newConf =
ProviderUtils.excludeIncompatibleCredentialProviders(conf,
AliyunOSSFileSystem.class);
credentials = new AliyunCredentialsProvider(newConf);
} else {
try {
LOG.debug("Credential provider class is:" + className);
Class<?> credClass = Class.forName(className);
try {
credentials =
(CredentialsProvider)credClass.getDeclaredConstructor(
URI.class, Configuration.class).newInstance(uri, conf);
} catch (NoSuchMethodException | SecurityException e) {
credentials =
(CredentialsProvider)credClass.getDeclaredConstructor()
.newInstance();
}
} catch (ClassNotFoundException e) {
{code}
> AliyunOSS: exception will be thrown if configure fs.oss.credentials.provider to AliyunCredentialsProvider
> ---------------------------------------------------------------------------------------------------------
>
> Key: HADOOP-15953
> URL: https://issues.apache.org/jira/browse/HADOOP-15953
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs/oss
> Affects Versions: 2.10.0, 3.2.0, 2.9.2, 3.3.0, 3.1.2
> Reporter: wujinhu
> Assignee: wujinhu
> Priority: Major
>
> Hadoop aliyun module uses AliyunCredentialsProvider as default CredentialsProvider if user do not set fs.oss.credentials.provider. However, if user set fs.oss.credentials.provider to org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider, exception will be thrown like below:
>
> {code:java}
> java.io.IOException: org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider constructor exception. A class specified in fs.oss.credentials.provider must provide an accessible constructor accepting URI and Configuration, or an accessible default constructor.
> at org.apache.hadoop.fs.aliyun.oss.AliyunOSSUtils.getCredentialsProvider(AliyunOSSUtils.java:131)
> at org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystemStore.initialize(AliyunOSSFileSystemStore.java:154)
> at org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem.initialize(AliyunOSSFileSystem.java:344)
> at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3302)
> at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:124)
> at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:3351)
> at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:3319)
> at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:479)
> at org.apache.hadoop.fs.contract.AbstractBondedFSContract.init(AbstractBondedFSContract.java:72)
> at org.apache.hadoop.fs.contract.AbstractFSContractTestBase.setup(AbstractFSContractTestBase.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
> at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
> at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
> at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
> at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
> at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.NoSuchMethodException: org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider.<init>()
> at java.lang.Class.getConstructor0(Class.java:3082)
> at java.lang.Class.getDeclaredConstructor(Class.java:2178)
> at org.apache.hadoop.fs.aliyun.oss.AliyunOSSUtils.getCredentialsProvider(AliyunOSSUtils.java:125)
> ... 23 more
> {code}
> Because AliyunCredentialsProvider does not have corresponding constructor.
>
>
> {code:java}
> public class AliyunCredentialsProvider implements CredentialsProvider {
> private Credentials credentials = null;
> public AliyunCredentialsProvider(Configuration conf) throws IOException {
> --------------------------------------------------
> String className = conf.getTrimmed(CREDENTIALS_PROVIDER_KEY);
> if (StringUtils.isEmpty(className)) {
> Configuration newConf =
> ProviderUtils.excludeIncompatibleCredentialProviders(conf,
> AliyunOSSFileSystem.class);
> credentials = new AliyunCredentialsProvider(newConf);
> } else {
> try {
> LOG.debug("Credential provider class is:" + className);
> Class<?> credClass = Class.forName(className);
> try {
> credentials =
> (CredentialsProvider)credClass.getDeclaredConstructor(
> URI.class, Configuration.class).newInstance(uri, conf);
> } catch (NoSuchMethodException | SecurityException e) {
> credentials =
> (CredentialsProvider)credClass.getDeclaredConstructor()
> .newInstance();
> }
> } catch (ClassNotFoundException e) {
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org