2015-08-26 5 views
3

Я работаю над расширением для druid, которое использует jclouds для файлов облачных хранилищ Rackspace, и я столкнулся с проблемой с Google guice, m не очень уверен в Java.

Я уже видел this question, но, похоже, конфликт в вариантах с изображением отсутствует.

Это код, который выполняется:

@Provides 
@LazySingleton 
public CloudFilesApi getCloudFilesApi(final CloudFilesAccountConfig config) { 
    log.info("Provider: " + config.getProvider()); 
    log.info("Username: " + config.getUserName()); 
    log.info("Api key: " + config.getApiKey()); 
    ContextBuilder cb = ContextBuilder.newBuilder(config.getProvider()); 
    log.info("Context builder built."); 
    cb = cb.credentials(config.getUserName(), config.getApiKey()); 
    log.info("Context builder authenticated."); 
    CloudFilesApi cfa = cb.buildApi(CloudFilesApi.class); 
    log.info("Cloud Files Api built."); 
    return cfa; 
} 

и это бревно:

2015-08-26T13:15:53,663 INFO [main] io.druid.guice.JsonConfigurator - Loaded class[class io.druid.storage.cloudfiles.CloudFilesAccountConfig] from props[druid.cloudfiles.] as [[email protected]] 
2015-08-26T13:15:53,664 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Provider: rackspace-cloudfiles-us 
2015-08-26T13:15:53,664 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Username: <value> 
2015-08-26T13:15:53,665 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Api key: <value> 
2015-08-26T13:15:54,425 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Context builder built. 
2015-08-26T13:15:54,425 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Context builder authenticated. 
Exception in thread "main" com.google.inject.CreationException: Guice creation errors: 

1) Error injecting constructor, java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions 
    at io.druid.guice.FireDepartmentsProvider.<init>(FireDepartmentsProvider.java:41) 
    while locating io.druid.guice.FireDepartmentsProvider 
    at io.druid.guice.RealtimeModule.configure(RealtimeModule.java:79) 
    while locating java.util.List<io.druid.segment.realtime.FireDepartment> 
    for parameter 0 at io.druid.segment.realtime.RealtimeMetricsMonitor.<init>(RealtimeMetricsMonitor.java:42) 
    while locating io.druid.segment.realtime.RealtimeMetricsMonitor 
    at io.druid.server.metrics.MetricsModule.getMonitorScheduler(MetricsModule.java:78) 
    at io.druid.server.metrics.MetricsModule.getMonitorScheduler(MetricsModule.java:78) 
    while locating com.metamx.metrics.MonitorScheduler 
    at io.druid.server.metrics.MetricsModule.configure(MetricsModule.java:63) 
    while locating com.metamx.metrics.MonitorScheduler annotated with @com.google.inject.name.Named(value=ForTheEagerness) 

1 error 
     at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448) 
     at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184) 
     at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110) 
     at com.google.inject.Guice.createInjector(Guice.java:96) 
     at com.google.inject.Guice.createInjector(Guice.java:73) 
     at com.google.inject.Guice.createInjector(Guice.java:62) 
     at io.druid.initialization.Initialization.makeInjectorWithModules(Initialization.java:412) 
     at io.druid.cli.GuiceRunnable.makeInjector(GuiceRunnable.java:55) 
     at io.druid.cli.ServerRunnable.run(ServerRunnable.java:37) 
     at io.druid.cli.Main.main(Main.java:91) 
Caused by: java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions 
     at org.nnsoft.guice.rocoto.configuration.ConfigurationModule.configure(ConfigurationModule.java:64) 
     at com.google.inject.AbstractModule.configure(AbstractModule.java:62) 
     at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:230) 
     at com.google.inject.spi.Elements.getElements(Elements.java:103) 
     at com.google.inject.spi.Elements.getElements(Elements.java:94) 
     at org.nnsoft.guice.rocoto.Rocoto.expandVariables(Rocoto.java:52) 
     at org.nnsoft.guice.rocoto.Rocoto.expandVariables(Rocoto.java:47) 
     at org.jclouds.config.BindPropertiesToExpandedValues.configure(BindPropertiesToExpandedValues.java:45) 
     at com.google.inject.AbstractModule.configure(AbstractModule.java:62) 
     at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:230) 
     at com.google.inject.spi.Elements.getElements(Elements.java:103) 
     at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136) 
     at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104) 
     at com.google.inject.Guice.createInjector(Guice.java:96) 
     at com.google.inject.Guice.createInjector(Guice.java:84) 
     at org.jclouds.ContextBuilder.expandProperties(ContextBuilder.java:382) 
     at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:317) 
     at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:644) 
     at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:636) 
     at io.druid.storage.cloudfiles.CloudFilesStorageDruidModule.getCloudFilesApi(CloudFilesStorageDruidModule.java:68) 
     [...] 

Я также не понимаю, почему строка "Cloud Files Api built." не печатается.

путь к классам является lib каталоге:

[email protected]:/opt/druid# ls lib | grep guice 
guice-4.0-beta.jar 
guice-assistedinject-3.0.jar 
guice-multibindings-4.0-beta.jar 
guice-servlet-4.0-beta.jar 
jersey-guice-1.17.1.jar 

UPDATE 1

Может быть связано с this issue? Я попытаюсь понизить рейтинг Google до 3.0.

UPDATE 2

Я понижен Google Guice 3.0, теперь у меня есть:

[email protected]:/opt/druid# ls lib | grep guice 
guice-3.0.jar 
guice-assistedinject-3.0.jar 
guice-multibindings-3.0.jar 
guice-servlet-3.0.jar 
jersey-guice-1.17.1.jar 

и теперь изменилась ошибка:

2015-08-26T14:22:06,978 INFO [main] io.druid.guice.JsonConfigurator - Loaded class[class io.druid.storage.cloudfiles.CloudFilesAccountConfig] from props[druid.cloudfiles.] as [[email protected]] 
2015-08-26T14:22:06,979 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Provider: rackspace-cloudfiles-us 
2015-08-26T14:22:06,980 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Username: viralizecloud 
2015-08-26T14:22:06,980 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Api key: df185fe598ed99ef27a247a21b578c3a 
2015-08-26T14:22:07,782 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Context builder built. 
2015-08-26T14:22:07,783 INFO [main] io.druid.storage.cloudfiles.CloudFilesStorageDruidModule - Context builder authenticated. 
Exception in thread "main" com.google.inject.CreationException: Guice creation errors: 

1) Error injecting constructor, java.lang.VerifyError: Cannot inherit from final class 
    at io.druid.guice.FireDepartmentsProvider.<init>(FireDepartmentsProvider.java:41) 
    while locating io.druid.guice.FireDepartmentsProvider 
    at io.druid.guice.RealtimeModule.configure(RealtimeModule.java:79) 
    while locating java.util.List<io.druid.segment.realtime.FireDepartment> 
    for parameter 0 at io.druid.segment.realtime.RealtimeMetricsMonitor.<init>(RealtimeMetricsMonitor.java:42) 
    while locating io.druid.segment.realtime.RealtimeMetricsMonitor 
    at io.druid.server.metrics.MetricsModule.getMonitorScheduler(MetricsModule.java:78) 
    at io.druid.server.metrics.MetricsModule.getMonitorScheduler(MetricsModule.java:78) 
    while locating com.metamx.metrics.MonitorScheduler 
    at io.druid.server.metrics.MetricsModule.configure(MetricsModule.java:63) 
    while locating com.metamx.metrics.MonitorScheduler annotated with @com.google.inject.name.Named(value=ForTheEagerness) 

1 error 
     at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435) 
     at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:183) 
     at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109) 
     at com.google.inject.Guice.createInjector(Guice.java:95) 
     at com.google.inject.Guice.createInjector(Guice.java:72) 
     at com.google.inject.Guice.createInjector(Guice.java:62) 
     at io.druid.initialization.Initialization.makeInjectorWithModules(Initialization.java:412) 
     at io.druid.cli.GuiceRunnable.makeInjector(GuiceRunnable.java:55) 
     at io.druid.cli.ServerRunnable.run(ServerRunnable.java:37) 
     at io.druid.cli.Main.main(Main.java:91) 
Caused by: java.lang.VerifyError: Cannot inherit from final class 
     at java.lang.ClassLoader.defineClass1(Native Method) 
     at java.lang.ClassLoader.defineClass(ClassLoader.java:800) 
     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
     at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) 
     at java.net.URLClassLoader.access$100(URLClassLoader.java:71) 
     at java.net.URLClassLoader$1.run(URLClassLoader.java:361) 
     at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:425) 
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:358) 
     at java.lang.Class.getDeclaredConstructors0(Native Method) 
     at java.lang.Class.privateGetDeclaredConstructors(Class.java:2595) 
     at java.lang.Class.getDeclaredConstructors(Class.java:1914) 
     at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:243) 
     at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:96) 
     at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629) 
     at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:845) 
     at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:772) 
     at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:256) 
     at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:205) 
     at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:853) 
     at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:46) 
     at com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:50) 
     at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:133) 
     at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106) 
     at com.google.inject.Guice.createInjector(Guice.java:95) 
     at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:402) 
     at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:326) 
     at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:644) 
     at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:636) 
     at io.druid.storage.cloudfiles.CloudFilesStorageDruidModule.getCloudFilesApi(CloudFilesStorageDruidModule.java:68) 
     [...] 
+0

Текущая банка кажется старой и не имеет класса Preconditions. Вы должны пойти на другую версию баннера. –

+0

Я собираюсь попробовать. – se7entyse7en

ответ

1

Глядя на вашем пути к классам:

guice-4.0-beta.jar 
guice-assistedinject-3.0.jar 

Вы используете Guice v4.0b, но v3.0 расширения AssistedInject Guice. Вы должны обновить их все сразу от версии к версии. Похоже, вы отбросили все обратно на v3.0, что работает, но вместо этого вы можете обновить расширение AssistedInject.

 Смежные вопросы

  • Нет связанных вопросов^_^