title: Google Cloud Search Database Connector Issues
body: <p>I am working with Google Cloud search (<a href="https://developers.google.com/cloud-search/docs/guides/?_ga=2.124920714.-122300216.1578247736" rel="nofollow noreferrer">https://developers.google.com/cloud-search/docs/guides/?_ga=2.124920714.-122300216.1578247736</a>) and I am attempting to index a Cloud SQL instance. Presently I am using the guide as shown here (<a href="https://developers.google.com/cloud-search/docs/guides/database-connector#important-considerations" rel="nofollow noreferrer">https://developers.google.com/cloud-search/docs/guides/database-connector#important-considerations</a>). I have registered source in G-Suite. I have a Cloud Search Service Account, I tested that I connect to the Cloud SQL instance from my Compute Engine instance which I can. </p>
  
  <p>My config file is as follows with the necessary information replaced with XXXX:</p>
  
  <pre><code>#
  # data source access
  api.sourceId=xxxxxxxxxxx
  api.identitySourceId=xxxxxxxxxxxxxxxx
  api.serviceAccountPrivateKeyFile=./private-key.json
  #
  # database access
  db.url=jdbc:mysql:///&lt;database&gt;?cloudSqlInstance=&lt;cloud_sql_instance&gt;&amp;socketFactory=mysql-socket-factory-connector-j-8&amp;useSSL=false&amp;user=xxxxxxxxx&amp;password=xxxxxxxxx
  #
  # traversal SQL statements
  db.allRecordsSql=select field_1, field_2, field_3 from table;
  #
  # schedule traversals
  schedule.traversalIntervalSecs=36000
  schedule.performTraversalOnStart=true
  schedule.incrementalTraversalIntervalSecs=3600
  #
  # column definitions
  db.allColumns= field1, field2, field3
  db.uniqueKeyColumns=field1
  url.columns=field1
  #
  # content fields
  contentTemplate.db.title=field1
  db.contentColumns=field1, field2, field3
  #
  # setting ACLs to "entire domain accessible"
  defaultAcl.mode=fallback
  defaultAcl.public=true
  </code></pre>
  
  <p>with the jdbc connection string being based off <a href="https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory" rel="nofollow noreferrer">https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory</a>. I'm at the stage where I run:</p>
  
  <pre><code>java \
     -cp "google-cloudsearch-database-connector-v1-0.0.3.jar:mysql-connector-java-5.1.41-bin.jar" \
     com.google.enterprise.cloudsearch.database.DatabaseFullTraversalConnector \
     [-Dconfig=mysql.config]
  </code></pre>
  
  <p>but i get the error <code>Failed to initialize connector</code>. The full stacktrace is:</p>
  
  <pre><code>Jan 05, 2020 6:29:38 PM com.google.enterprise.cloudsearch.sdk.indexing.IndexingApplication startUp
  SEVERE: Failed to initialize connector
  com.google.enterprise.cloudsearch.sdk.StartupException: Failed to initialize connector
          at com.google.enterprise.cloudsearch.sdk.Application.startConnector(Application.java:150)
          at com.google.enterprise.cloudsearch.sdk.indexing.IndexingApplication.startUp(IndexingApplication.java:96)
          at com.google.common.util.concurrent.AbstractIdleService$DelegateService$1.run(AbstractIdleService.java:62)
          at com.google.common.util.concurrent.Callables$4.run(Callables.java:122)
          at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.NullPointerException
          at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:871)
          at com.google.common.io.BaseEncoding$StandardBaseEncoding.trimTrailingPadding(BaseEncoding.java:672)
          at com.google.common.io.BaseEncoding.decodeChecked(BaseEncoding.java:226)
          at com.google.common.io.BaseEncoding.decode(BaseEncoding.java:212)
          at com.google.api.client.util.Base64.decodeBase64(Base64.java:93)
          at com.google.api.services.cloudsearch.v1.model.Item.decodeVersion(Item.java:329)
          at com.google.enterprise.cloudsearch.sdk.indexing.IndexingServiceImpl.indexItem(IndexingServiceImpl.java:678)
          at com.google.enterprise.cloudsearch.sdk.indexing.DefaultAcl.&lt;init&gt;(DefaultAcl.java:203)
          at com.google.enterprise.cloudsearch.sdk.indexing.DefaultAcl.&lt;init&gt;(DefaultAcl.java:93)
          at com.google.enterprise.cloudsearch.sdk.indexing.DefaultAcl$Builder.build(DefaultAcl.java:466)
          at com.google.enterprise.cloudsearch.sdk.indexing.DefaultAcl.fromConfiguration(DefaultAcl.java:266)
          at com.google.enterprise.cloudsearch.sdk.indexing.template.FullTraversalConnector.init(FullTraversalConnector.java:182)
          at com.google.enterprise.cloudsearch.sdk.indexing.template.FullTraversalConnector.init(FullTraversalConnector.java:97)
          at com.google.enterprise.cloudsearch.sdk.Application.startConnector(Application.java:142)
          ... 4 more
  Jan 05, 2020 6:29:38 PM com.google.enterprise.cloudsearch.sdk.BatchRequestService shutDown
  INFO: Shutting down batching service. flush on shutdown: true
  Exception in thread "main" java.lang.IllegalStateException: Expected the service IndexingApplication [FAILED] to be RUNNING, but the service has FAILED
          at com.google.common.util.concurrent.AbstractService.checkCurrentState(AbstractService.java:344)
          at com.google.common.util.concurrent.AbstractService.awaitRunning(AbstractService.java:280)
          at com.google.common.util.concurrent.AbstractIdleService.awaitRunning(AbstractIdleService.java:175)
          at com.google.enterprise.cloudsearch.sdk.Application.start(Application.java:122)
          at com.google.enterprise.cloudsearch.database.DatabaseFullTraversalConnector.main(DatabaseFullTraversalConnector.java:30)
  Caused by: com.google.enterprise.cloudsearch.sdk.StartupException: Failed to initialize connector
          at com.google.enterprise.cloudsearch.sdk.Application.startConnector(Application.java:150)
          at com.google.enterprise.cloudsearch.sdk.indexing.IndexingApplication.startUp(IndexingApplication.java:96)
          at com.google.common.util.concurrent.AbstractIdleService$DelegateService$1.run(AbstractIdleService.java:62)
          at com.google.common.util.concurrent.Callables$4.run(Callables.java:122)
          at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.NullPointerException
          at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:871)
          at com.google.common.io.BaseEncoding$StandardBaseEncoding.trimTrailingPadding(BaseEncoding.java:672)
          at com.google.common.io.BaseEncoding.decodeChecked(BaseEncoding.java:226)
          at com.google.common.io.BaseEncoding.decode(BaseEncoding.java:212)
          at com.google.api.client.util.Base64.decodeBase64(Base64.java:93)
          at com.google.api.services.cloudsearch.v1.model.Item.decodeVersion(Item.java:329)
          at com.google.enterprise.cloudsearch.sdk.indexing.IndexingServiceImpl.indexItem(IndexingServiceImpl.java:678)
          at com.google.enterprise.cloudsearch.sdk.indexing.DefaultAcl.&lt;init&gt;(DefaultAcl.java:203)
          at com.google.enterprise.cloudsearch.sdk.indexing.DefaultAcl.&lt;init&gt;(DefaultAcl.java:93)
          at com.google.enterprise.cloudsearch.sdk.indexing.DefaultAcl$Builder.build(DefaultAcl.java:466)
          at com.google.enterprise.cloudsearch.sdk.indexing.DefaultAcl.fromConfiguration(DefaultAcl.java:266)
          at com.google.enterprise.cloudsearch.sdk.indexing.template.FullTraversalConnector.init(FullTraversalConnector.java:182)
          at com.google.enterprise.cloudsearch.sdk.indexing.template.FullTraversalConnector.init(FullTraversalConnector.java:97)
  </code></pre>