在这里,我试图从谷歌驱动器 下载(复制)一个文件,但我得到的错误是我还不明白。 我不确定源路由 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的类路径问题。 –
非常感谢。我在做这个工作。 –