Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hello, when i try to connect to the Java App i've created for the first time using no redirect requesting i get a fatal error just on the DbxAuthFinish, giving me a java.lang.ExceptionInitializerError. I checked out many times but my code is still the same as the example found in the API tutorials. Here is my code:
String accessToken = ""; String userLocale = null; DbxRequestConfig requestConfig = new DbxRequestConfig("text-edit/0.1",userLocale); DbxAppInfo appInfo = new DbxAppInfo(APP_KEY,SECRET_KEY); DbxWebAuth auth = new DbxWebAuth(requestConfig, appInfo); DbxWebAuth.Request requestAuth = DbxWebAuth.newRequestBuilder().withNoRedirect().build(); String authorizeUrl = auth.authorize(requestAuth); System.out.println("1. Go to " + authorizeUrl); System.out.println("2. Click \"Allow\" (you might have to log in first)."); System.out.println("3. Copy the authorization code."); //Abrimos el enlace de autenticación del paciente en la carpeta de DropBox try { URL authenticationURL = new URL(authorizeUrl); Desktop.getDesktop().browse(authenticationURL.toURI()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } String code = JOptionPane.showInputDialog(this.ventanaControlada, "Inserta el codigo de verificación."); System.out.println(code); code = code.trim(); try { DbxAuthFinish authFinish = auth.finishFromCode(code); accessToken = authFinish.getAccessToken(); } catch (Exception e) {
Thanks for all, i hope you can find any response soon!
Exception in thread "main" java.lang.ExceptionInInitializerError at com.dropbox.core.DbxRequestUtil.buildUserAgentHeader(DbxRequestUtil.java:146) at com.dropbox.core.DbxRequestUtil.addUserAgentHeader(DbxRequestUtil.java:131) at com.dropbox.core.DbxRequestUtil.startPostRaw(DbxRequestUtil.java:228) at com.dropbox.core.DbxRequestUtil.startPostNoAuth(DbxRequestUtil.java:211) at com.dropbox.core.DbxRequestUtil$2.run(DbxRequestUtil.java:389) at com.dropbox.core.DbxRequestUtil.runAndRetry(DbxRequestUtil.java:434) at com.dropbox.core.DbxRequestUtil.doPostNoAuth(DbxRequestUtil.java:386) at com.dropbox.core.DbxWebAuth.finish(DbxWebAuth.java:401) at com.dropbox.core.DbxWebAuth.finish(DbxWebAuth.java:383) at com.dropbox.core.DbxWebAuth.finishFromCode(DbxWebAuth.java:295) at Control.ImageDropBoxController.StartFirstConnection(ImageDropBoxController.java:154) at Control.ImageDropBoxController.main(ImageDropBoxController.java:171) Caused by: java.lang.RuntimeException: Error loading version from resource "sdk-version.txt": Text doesn't follow expected pattern: "${project.version}" at com.dropbox.core.DbxSdkVersion.loadVersion(DbxSdkVersion.java:66) at com.dropbox.core.DbxSdkVersion.<clinit>(DbxSdkVersion.java:17) ... 12 more
ImageDropBoxController it's the class where im testing the connection.
I just got the Java API from the webpage https://github.com/dropbox/dropbox-sdk-java/releases/tag/v3.0.3
and added the jar to my Eclipse project. Then build and configure the path's to the .jar's and compile it. Works fine just until the line marked on the stacktrace error i pasted above.
Yeah, i had both of them, i removed the dropbox-core-sd-3.0.3-sources.jar and now works perfectly fine. Thanks for all!
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!