我在Apache Camel 2.14应用程序中使用新的Google Drive组件。 目前它不起作用,这是应用程序:
private String accessToken = ...
private String applicationName = "camel-mytest";
private String clientId = ...
private String clientSecret = ...
private String refreshToken = ...
private List<String> scopes = Arrays.asList("https://www.googleapis.com/auth/drive");
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
camelContext = (CamelContext) applicationContext.getBean("idGoogleDriveCamelContext");
GoogleDriveConfiguration configuration = new GoogleDriveConfiguration();
configuration.setAccessToken(accessToken);
configuration.setApplicationName(applicationName);
configuration.setClientId(clientId);
configuration.setClientSecret(clientSecret);
configuration.setRefreshToken(refreshToken);
configuration.setScopes(scopes);
GoogleDriveComponent googleDriveComponent = new GoogleDriveComponent();
googleDriveComponent.setConfiguration(configuration);
camelContext.addComponent("google-drive", googleDriveComponent);
camelContext.start();
这是我的路线:
from("google-drive://drive-about/get")
.log(LoggingLevel.INFO, "${body}");
我已按照here所述创建了客户端ID和客户端密码,我在OAuth游乐场设置 https://www.googleapis.com/auth/drive 范围内获取了访问令牌和刷新令牌。 我已将Google Drive maven依赖项放在我的pom.xml文件中。
这是堆栈跟踪:
[2014-09-29 10:35:55,124] Artifact camel-googledrive:war: Error during artifact deployment. See server log for details.
[2014-09-29 10:35:55,125] Artifact camel-googledrive:war: java.lang.Exception: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"camel-googledrive-1.0-SNAPSHOT.war\".component.Bootstrap.START" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"camel-googledrive-1.0-SNAPSHOT.war\".component.Bootstrap.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
Caused by: javax.ejb.EJBException: org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[google-drive://drive-about/get]] -> [Log... because of Failed to resolve endpoint: google-drive://drive-about/get due to: null
Caused by: org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[google-drive://drive-about/get]] -> [Log... because of Failed to resolve endpoint: google-drive://drive-about/get due to: null
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[google-drive://drive-about/get]] -> [Log... because of Failed to resolve endpoint: google-drive://drive-about/get due to: null
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: google-drive://drive-about/get due to: null
Caused by: java.lang.NullPointerException"}}
是组件初始化还是sintax问题?谢谢