开发者

amazon AWS in web app, InstantiationError: com.amazonaws.handlers.b

i'm trying to use amazon AWS in a java web application, running in apache tomcat. when i run my app, it fails with,

java.lang.InstantiationError: com.amazonaws.handlers.b
    com.amazonaws.services.s3.AmazonS3Client.<init>(Unknown Source)
    com.amazonaws.services.s3.AmazonS3Client.<init>(Unknown Source)
    org.test.msync.photoweb.PhotoWebServlet.processRequest(PhotoWebServlet.java:47)
    org.test.msync.photoweb.PhotoWebServlet.doGet(PhotoWebServlet.java:104)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

any ideas?

looking at the code for AmazonS3Client, it appears to be trying to load a resource named "request.handlers", which does not exist in the SDK jar ... and i cannot find any reference to it anywhere else.

edit: correction, request.handlers is in the JAR, but the ve开发者_如何学Pythonrsion under S3 is empty. no idea where the "b" is coming from.

edit: removing tomcat tag, as i tried on glassfish with the same result. note that it does work in a java SE env.


the fact that it's working in a java se environment should tell us that it's a class path issue. meaning that the error comes from a class missing on the class path, probably a class named b. how did you deploy your tomcat? how did you run the version in java se that worked? through eclipse? are you running tomcat through eclipse as well? i'm guessing that you're missing some jar-file on the tomcat class path. putting the missing jar-file in the folder where tomcat is running the application, under WEB-INF/lib, should fix this. where this folder is depends a bit on your setup though.

if this doesn't help, then please give more information on your setup, both for tomcat execution and java se :)


I turned off "antiLockingJARs" in Context.xml and the problem went away.

If true, the Tomcat classloader will take extra measures to avoid JAR file locking when resources are accessed inside JARs through URLs. This will impact startup time of applications, but could prove to be useful on platforms or configurations where file locking can occur. If not specified, the default value is false.

I can't explain why the AWS jar had problems with this setting. It was set to true by default when I created a new web application project through netbeans (6.9.1).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜