2

所以在我的POM中我有

<dependency>
  <groupId>com.amazonaws</groupId>
  <artifactId>aws-java-sdk</artifactId>
  <version>1.5.8</version>
</dependency>

当我第一次创建我的客户时:

AmazonS3 s3 = new AmazonS3Client(Config.AWS_CREDENTIALS);

我得到一个例外

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
  at com.amazonaws.services.s3.AmazonS3Client.<clinit>(AmazonS3Client.java:193)
  at (my code)
  at (glassfish trace)
  at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  ... 48 more

任何想法?谢谢

4

1 回答 1

0

该错误表明您缺少公共日志记录依赖项,请将其添加到您的 Maven 文件中:

    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>

那应该有帮助。

于 2014-03-15T19:04:31.257 回答