<p dir="auto">Ran into this test failure case while building locally</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.599 sec &lt;&lt;&lt; FAILURE! - in io.druid.metadata.SQLMetadataSupervisorManagerTest
testInsertAndGet(io.druid.metadata.SQLMetadataSupervisorManagerTest)  Time elapsed: 0.599 sec  &lt;&lt;&lt; ERROR!
org.skife.jdbi.v2.exceptions.CallbackFailedException: org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL160506204201978' defined on 'DRUIDTEST7CB9E3D334F949E0B23A8BE51C7EAFE8_SUPERVISORS'. [statement:&quot;INSERT INTO druidTest7cb9e3d334f949e0b23a8be51c7eafe8_supervisors (id, spec_id, version, payload) VALUES (:id, :spec_id, :version, :payload)&quot;, located:&quot;INSERT INTO druidTest7cb9e3d334f949e0b23a8be51c7eafe8_supervisors (id, spec_id, version, payload) VALUES (:id, :spec_id, :version, :payload)&quot;, rewritten:&quot;INSERT INTO druidTest7cb9e3d334f949e0b23a8be51c7eafe8_supervisors (id, spec_id, version, payload) VALUES (?, ?, ?, ?)&quot;, arguments:{ positional:{}, named:{id:'test-supervisor-1_2016-05-06T20:42:01.963Z',payload:[123, 34, 116, 121, 112, 101, 34, 58, 34, 84, 101, 115, 116, 83, 117, 112, 101, 114, 118, 105, 115, 111, 114, 83, 112, 101, 99, 34, 44, 34, 105, 100, 34, 58, 34, 116, 101, 115, 116, 45, 115, 117, 112, 101, 114, 118, 105, 115, 111, 114, 45, 49, 34, 44, 34, 100, 97, 116, 97, 34, 58, 123, 34, 107, 101, 121, 49, 45, 49, 34, 58, 34, 118, 97, 108, 117, 101, 49, 45, 49, 45, 51, 34, 44, 34, 107, 101, 121, 49, 45, 50, 34, 58, 34, 118, 97, 108, 117, 101, 49, 45, 50, 45, 51, 34, 125, 125],spec_id:'test-supervisor-1',version:'2016-05-06T20:42:01.963Z'}, finder:[]}]
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(Unknown Source)
    at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(Unknown Source)
    at org.apache.derby.impl.sql.execute.IndexChanger.insert(Unknown Source)
    at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(Unknown Source)
    at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(Unknown Source)
    at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown Source)
    at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source)
    at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
    at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source)
    at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1328)
    at org.skife.jdbi.v2.Update.execute(Update.java:56)
    at io.druid.metadata.SQLMetadataSupervisorManager$1.withHandle(SQLMetadataSupervisorManager.java:88)
    at io.druid.metadata.SQLMetadataSupervisorManager$1.withHandle(SQLMetadataSupervisorManager.java:83)
    at org.skife.jdbi.v2.DBI.withHandle(DBI.java:281)
    at io.druid.metadata.SQLMetadataSupervisorManager.insert(SQLMetadataSupervisorManager.java:81)
    at io.druid.metadata.SQLMetadataSupervisorManagerTest.testInsertAndGet(SQLMetadataSupervisorManagerTest.java:99)"><pre class="notranslate"><code class="notranslate">Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.599 sec &lt;&lt;&lt; FAILURE! - in io.druid.metadata.SQLMetadataSupervisorManagerTest
testInsertAndGet(io.druid.metadata.SQLMetadataSupervisorManagerTest)  Time elapsed: 0.599 sec  &lt;&lt;&lt; ERROR!
org.skife.jdbi.v2.exceptions.CallbackFailedException: org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL160506204201978' defined on 'DRUIDTEST7CB9E3D334F949E0B23A8BE51C7EAFE8_SUPERVISORS'. [statement:"INSERT INTO druidTest7cb9e3d334f949e0b23a8be51c7eafe8_supervisors (id, spec_id, version, payload) VALUES (:id, :spec_id, :version, :payload)", located:"INSERT INTO druidTest7cb9e3d334f949e0b23a8be51c7eafe8_supervisors (id, spec_id, version, payload) VALUES (:id, :spec_id, :version, :payload)", rewritten:"INSERT INTO druidTest7cb9e3d334f949e0b23a8be51c7eafe8_supervisors (id, spec_id, version, payload) VALUES (?, ?, ?, ?)", arguments:{ positional:{}, named:{id:'test-supervisor-1_2016-05-06T20:42:01.963Z',payload:[123, 34, 116, 121, 112, 101, 34, 58, 34, 84, 101, 115, 116, 83, 117, 112, 101, 114, 118, 105, 115, 111, 114, 83, 112, 101, 99, 34, 44, 34, 105, 100, 34, 58, 34, 116, 101, 115, 116, 45, 115, 117, 112, 101, 114, 118, 105, 115, 111, 114, 45, 49, 34, 44, 34, 100, 97, 116, 97, 34, 58, 123, 34, 107, 101, 121, 49, 45, 49, 34, 58, 34, 118, 97, 108, 117, 101, 49, 45, 49, 45, 51, 34, 44, 34, 107, 101, 121, 49, 45, 50, 34, 58, 34, 118, 97, 108, 117, 101, 49, 45, 50, 45, 51, 34, 125, 125],spec_id:'test-supervisor-1',version:'2016-05-06T20:42:01.963Z'}, finder:[]}]
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(Unknown Source)
    at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(Unknown Source)
    at org.apache.derby.impl.sql.execute.IndexChanger.insert(Unknown Source)
    at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(Unknown Source)
    at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(Unknown Source)
    at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown Source)
    at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source)
    at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
    at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source)
    at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1328)
    at org.skife.jdbi.v2.Update.execute(Update.java:56)
    at io.druid.metadata.SQLMetadataSupervisorManager$1.withHandle(SQLMetadataSupervisorManager.java:88)
    at io.druid.metadata.SQLMetadataSupervisorManager$1.withHandle(SQLMetadataSupervisorManager.java:83)
    at org.skife.jdbi.v2.DBI.withHandle(DBI.java:281)
    at io.druid.metadata.SQLMetadataSupervisorManager.insert(SQLMetadataSupervisorManager.java:81)
    at io.druid.metadata.SQLMetadataSupervisorManagerTest.testInsertAndGet(SQLMetadataSupervisorManagerTest.java:99)
</code></pre></div>
<p dir="auto">Currently the initialization routine checks for implementations in the extension coordinates, and optionally (via <code class="notranslate">druid.extensions.searchCurrentClassloader</code>) in the classpath.</p>
<p dir="auto">This can cause unexpected binding behavior where items are attempted to be bound twice if the extension happens to also be in the classpath.</p>
<p dir="auto">Steps to reproduce:<br>
1.Unzip a fresh copy of the services self contained tar.gz<br>
2.Copy an extension to the lib directory which happens to also be in the list of coordinates under config/_common <code class="notranslate">cp ~/.m2/repository/io/druid/extensions/mysql-metadata-storage/0.7.0-SNAPSHOT/mysql-metadata-storage-0.7.0-SNAPSHOT.jar lib/</code><br>
3.Run it <code class="notranslate">java -cp config/_common/:config/coordinator/:lib/* io.druid.cli.Main server coordinator</code></p>
<p dir="auto">result:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2015-01-07 11:26:58,945 INFO [main] io.druid.initialization.Initialization - Adding extension module[class io.druid.metadata.storage.mysql.MySQLMetadataStorageModule] for class[io.druid.initialization.DruidModule]
Exception in thread &quot;main&quot; com.google.inject.CreationException: Guice creation errors:

1) Map injection failed due to duplicated key &quot;mysql&quot;
  at com.google.inject.multibindings.MapBinder$RealMapBinder$1.initialize(MapBinder.java:357)
  at io.druid.guice.PolyBind.optionBinder(PolyBind.java:94)

1 error
    at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:176)
    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:371)
    at io.druid.cli.GuiceRunnable.makeInjector(GuiceRunnable.java:57)
    at io.druid.cli.ServerRunnable.run(ServerRunnable.java:39)
    at io.druid.cli.Main.main(Main.java:90)"><pre class="notranslate"><code class="notranslate">2015-01-07 11:26:58,945 INFO [main] io.druid.initialization.Initialization - Adding extension module[class io.druid.metadata.storage.mysql.MySQLMetadataStorageModule] for class[io.druid.initialization.DruidModule]
Exception in thread "main" com.google.inject.CreationException: Guice creation errors:

1) Map injection failed due to duplicated key "mysql"
  at com.google.inject.multibindings.MapBinder$RealMapBinder$1.initialize(MapBinder.java:357)
  at io.druid.guice.PolyBind.optionBinder(PolyBind.java:94)

1 error
    at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:176)
    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:371)
    at io.druid.cli.GuiceRunnable.makeInjector(GuiceRunnable.java:57)
    at io.druid.cli.ServerRunnable.run(ServerRunnable.java:39)
    at io.druid.cli.Main.main(Main.java:90)
</code></pre></div>
<p dir="auto">Alternatively, put the extension's jar in the classpath, then run with a COMPLETELY DIFFERENT extension (like <code class="notranslate">druid.extensions.coordinates=["io.druid.extensions:druid-kafka-seven"]</code>)</p>
<p dir="auto">same effect.</p>