开发者社区> 问答> 正文

求助:Java web,用jsp和servlet实现向OSS上传下载功能,无法创建OSSClient实例


web工程,用jsp+servlet实现向OSS上传下载功能,在servlet中创建OSSClient实例报错,求各路大神指导一下怎么解决,拜谢。(不会用maven)。

Java报错信息:严重: Servlet.service() for servlet [servlet.servletTest] in context with path [/oos-test] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: com.aliyun.oss.OSSClient
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
    at util.OSSManageUtil.downloadFile(OSSManageUtil.java:83)
    at servlet.servletTest.doPost(servletTest.java:52)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)


展开
收起
yyjiaotx 2017-07-20 11:13:55 2950 0
3 条回答
写回答
取消 提交回答
  • Re求助:Java web,用jsp和servlet实现向OSS上传下载功能,无法创建OSSClient实
    我也出现了这个问题。。。
    2018-07-02 14:47:53
    赞同 展开评论 打赏
  • 回 楼主yyjiaotx的帖子
    现在已经用maven做了,就不会出现上面问题了。但还是谢谢大神回复。
    2017-07-24 09:26:25
    赞同 展开评论 打赏
  • Re:求助:Java web,用jsp和servlet实现向OSS上传下载功能,无法创建OSSClient实 ..
    错误提示ossclient类没有发现,建议按照官方文档配置,然后用官方的例子试一下:
    https://help.aliyun.com/document_detail/32008.html?spm=5176.doc31947.6.658.yGHdTa
    2017-07-23 08:24:41
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载