Note that there are some explanatory texts on larger screens.

plurals
  1. PONoSuchMethodError with YouTube API in Java
    primarykey
    data
    text
    <p>I am writing a code in Java to upload videos to youtube from mu application.</p> <p><strong>My code is :</strong> </p> <pre><code>package com.youtube.video; import java.io.IOException; import java.net.URL; import com.google.gdata.client.youtube.YouTubeService; import com.google.gdata.data.media.mediarss.MediaCategory; import com.google.gdata.data.media.mediarss.MediaDescription; import com.google.gdata.data.media.mediarss.MediaKeywords; import com.google.gdata.data.media.mediarss.MediaTitle; import com.google.gdata.data.youtube.FormUploadToken; import com.google.gdata.data.youtube.VideoEntry; import com.google.gdata.data.youtube.YouTubeMediaGroup; import com.google.gdata.data.youtube.YouTubeNamespace; import com.google.gdata.util.AuthenticationException; import com.google.gdata.util.ServiceException; public class YouTubeController { public static YouTubeService service; public void init() { if (service == null) { service = new YouTubeService("mail@gmail.com", "A...A"); String username = "mail@gmail.com"; String password = "xxxxxxxxx"; try { service.setUserCredentials(username, password); } catch (AuthenticationException ae) { ae.printStackTrace(); } } } static String token; static String formUrl; public static void setFormDetails() throws IOException { VideoEntry newEntry = new VideoEntry(); YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup(); String videoTitle = "this is a title"; mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos")); mg.setTitle(new MediaTitle()); mg.setPrivate(false); mg.setKeywords(new MediaKeywords()); mg.getKeywords().addKeyword(""); mg.getTitle().setPlainTextContent(videoTitle); mg.setDescription(new MediaDescription()); mg.getDescription().setPlainTextContent(videoTitle); URL uploadUrl = new URL("http://gdata.youtube.com/action/GetUploadToken"); try { FormUploadToken fut = service.getFormUploadToken(uploadUrl, newEntry); token = fut.getToken(); System.out.println("&gt;&gt;&gt;&gt;&gt;"+token); formUrl = fut.getUrl(); } catch (ServiceException se) { se.printStackTrace(); } } public static void main(String s[]) throws IOException { YouTubeController yc = new YouTubeController(); yc.init(); yc.setFormDetails(); } } </code></pre> <p>I have the following jars in lib folder :</p> <p>gdata-client-1.0.jar gdata-youtube-2.0.jar gdata-core-1.0.jar gdata-media-1.0.jar google-collect-1.0.jar guava-13.0.1.jar mail.jar activation.jar</p> <p>But while running this piece of code, <strong>it is giving me the following error</strong> : </p> <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet; at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableTypes(AltFormat.java:399) at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableXmlTypes(AltFormat.java:387) at com.google.gdata.wireformats.AltFormat.&lt;clinit&gt;(AltFormat.java:49) at com.google.gdata.client.Service.&lt;clinit&gt;(Service.java:558) at com.zeta.video.YouTubeController.init(YouTubeController.java:23) at com.zeta.video.YouTubeController.main(YouTubeController.java:66) </code></pre> <p>I tried all solutions over net, and all of them points out that this error is because i am missing some JAR files. But i am having all the JARs. Can someone help me with this issue?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload