所以在我的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
任何想法?谢谢
最佳答案
该错误表明您缺少公共记录日志依赖项,请将其添加到您的Maven文件中:
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
那应该有帮助。
关于java - 如何在Glassfish上将Amazon Java SDK与Maven结合使用?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19053457/