在這裏,我試圖從谷歌驅動器 下載(複製)一個文件,但我得到的錯誤是我還不明白。 我不確定源路由 from().to(localDrive)
的正確說法。如何通過apache駱駝從谷歌驅動器下載文件,我得到AbstractApiComponent無法訪問?
public class GdriveCopyFile {
public static void main(String ar[])throws Exception{
ArrayList<String> scope = new ArrayList<String>();
scope.add("https://www.googleapis.com/auth/drive.file");
CamelContext context=new DefaultCamelContext();
GoogleDriveConfiguration configuration=new GoogleDriveConfiguration();
configuration.setApplicationName("GdriveCopyFile");
configuration.setClientId("..");
configuration.setClientSecret("..");
configuration.setScopes(scope);
configuration.setAccessToken("..);
configuration.setRefreshToken("..");
GoogleDriveComponent gDriveCompo=new GoogleDriveComponent();
gDriveCompo.setConfiguration(configuration); //32
context.addComponent("google-drive", gDriveCompo); //33
context.addRoutes(new RouteBuilder(){
@Override
public void configure()throws Exception{
from("google-drive://drive-files/copy?..").to("file:..");
}
});
context.start();
Thread.sleep(10000);
context.stop();
}}
錯誤:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project Google-Drive: Compilation
failure: Compilation failure: /home/rajat/workspace/Google-Drive/src/main/java/com/pkgName/gdrive /Google_Drive/GdriveCopyFile.java:[32,16] error: cannot access AbstractApiComponent class file for org.apache.camel.util.component.AbstractApiComponent not found/home/rajat/workspace/Google-Drive/src/main/java/com/pkgName/gdrive/Google_Drive/GdriveCopyFile.java:[33,42] error: incompatible types: GoogleDriveComponent cannot be converted to Component
而且我卡在這裏有什麼錯我的代碼?
也許你有一個混合版本的駱駝或一些缺少JAR的類路徑問題。 –
非常感謝。我在做這個工作。 –