No injectable constructor for type DynamicItem<BrokerApi>.

697 views
Skip to first unread message

Lexani42

unread,
Jun 15, 2022, 7:36:50 PM6/15/22
to Repo and Gerrit Discussion
Hello
I have some troubles with event-broker module when setting up multi-site gerrit plugin.

I tried to put event-broker.jar to modules folder, lib folder, plugins folder, plugins folder with link into lib folder, lib folder with link into plugins folder, but nothing helped me.

Versions:
gerrit 3.4
multi-site 3.3.0
event-broker 3.4.0

multi-site.config
```
[index]
  maxTries = 50
  retryInterval = 30000

[broker]
  bootstrapServers = kafka:9092
  securityProtocol = PLAINTEXT
  indexEventTopic = gerrit_index
  batchIndexEventTopic = gerrit_batch_index
  streamEventTopic = gerrit_stream
  projectListEventTopic = gerrit_list_project
  cacheEventTopic = gerrit_cache_eviction

[kafka "subscriber"]
  enabled = true
  pollingIntervalMs = 1000
  KafkaProp-enableAutoCommit = true
  KafkaProp-autoCommitIntervalMs = 1000
  KafkaProp-autoOffsetReset = latest

[kafka "publisher"]
  enabled = true

[ref-database "zookeeper"]
  connectString = zookeeper:2181
```
part of gerrit.config
```
[gerrit]
...
  installDbModule = com.googlesource.gerrit.plugins.multisite.GitModule
  installModule = com.googlesource.gerrit.plugins.multisite.Module
  instanceId = 123-123-123-123

[database]
  type = h2
  database = /home/jenkins/gerrit_agent/db/ReviewDB

[noteDb "changes"]
  autoMigrate = true
  disableReviewDb = true
  primaryStorage = note db
  read = true
  sequence = trut
  write = true
```
Error says:
```
com.google.inject.CreationException: Unable to create injector, see the following errors:

1) [Guice/MissingConstructor]: No injectable constructor for type DynamicItem<BrokerApi>.

class DynamicItem does not have a @Inject annotated constructor or a no-arg constructor.

Requested by:
1  : DynamicItem.class(DynamicItem.java:52)
     at BrokerApiWrapper.<init>(BrokerApiWrapper.java:48)
      \_ for 2nd parameter apiDelegate
     at PluginModule.configure(PluginModule.java:39)
2  : DynamicItem.class(DynamicItem.java:52)
     at MultiSiteConsumerRunner.<init>(MultiSiteConsumerRunner.java:38)
      \_ for 1st parameter brokerApi
     at LifecycleModule.listener(LifecycleModule.java:37)

Learn more:
  https://github.com/google/guice/wiki/MISSING_CONSTRUCTOR

1 error

======================
Full classname legend:
======================
BrokerApi:               "com.gerritforge.gerrit.eventbroker.BrokerApi"
BrokerApiWrapper:        "com.googlesource.gerrit.plugins.multisite.broker.BrokerApiWrapper"
DynamicItem:             "com.google.gerrit.extensions.registration.DynamicItem"
LifecycleModule:         "com.google.gerrit.lifecycle.LifecycleModule"
MultiSiteConsumerRunner: "com.googlesource.gerrit.plugins.multisite.consumer.MultiSiteConsumerRunner"
PluginModule:            "com.googlesource.gerrit.plugins.multisite.PluginModule"
========================
End of classname legend:
========================

  at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:568)
  at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:163)
  at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
  at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:239)
  at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:244)
  at com.google.gerrit.server.plugins.ServerPlugin.startPlugin(ServerPlugin.java:212)
  at com.google.gerrit.server.plugins.ServerPlugin.start(ServerPlugin.java:182)
  at com.google.gerrit.server.plugins.PluginLoader.runPlugin(PluginLoader.java:512)
  at com.google.gerrit.server.plugins.PluginLoader.rescan(PluginLoader.java:426)
  at com.google.gerrit.server.plugins.PluginLoader.start(PluginLoader.java:331)
  at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:95)
  at com.google.gerrit.pgm.Daemon.start(Daemon.java:377)
  at com.google.gerrit.pgm.Daemon.run(Daemon.java:280)
  at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.base/java.lang.reflect.Method.invoke(Method.java:566)
  at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:224)
  at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:120)
  at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:65)
  at Main.main(Main.java:28)```

David Ostrovsky

unread,
Jun 16, 2022, 1:49:17 AM6/16/22
to Repo and Gerrit Discussion
lexx...@gmail.com schrieb am Donnerstag, 16. Juni 2022 um 01:36:50 UTC+2:
Hello
I have some troubles with event-broker module when setting up multi-site gerrit plugin.

event-broker is an abstraction layer for messaging transport.
You are missing the actual implementation for specific backend.

Currently, there are four backend options:

o Apache Kafka: [1]
o AWS Kinesis: [2]
o GCP PubSub: [3]
o RabbitMQ: [4]

Reply all
Reply to author
Forward
0 new messages