【发布时间】:2015-07-13 13:34:43
【问题描述】:
我正在尝试使用此代码获取 google drive 的授权用户的名称:
public class list extends HttpServlet{
private DbxClient client;
String token;
public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException{
try{
DbxRequestConfig requestConfig = new
DbxRequestConfig("JavaDropBoxTutorial/1.0",Locale.getDefault().toString() );
HttpSession session = req.getSession();
token = session.getAttribute("access_token").toString();
client = new DbxClient(requestConfig, token);
session.setAttribute("dropuser",client.getAccountInfo().displayName);
User u = new User();
System.out.print(u.getDisplayName());
res.sendRedirect("listdetails.jsp");
}
catch(Exception e){
}
}
}
但是我得到了这个错误:-
HTTP 状态 500 - Servlet 执行引发异常
例外
javax.servlet.ServletException: Servlet 执行抛出异常 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
根本原因
java.lang.NoClassDefFoundError: com/google/common/base/Preconditions
【问题讨论】:
-
我正在尝试获取 google drive 的授权用户的名称
-
请考虑将您的代码示例缩减为 minimal, complete and verifiable example 并改进格式以使其更具可读性。
标签: java google-drive-api