Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

Added sbt-based project for Scala samples#110

Open
jcjimenez wants to merge 4 commits into
Azure:masterfrom
jcjimenez:scala_samples
Open

Added sbt-based project for Scala samples#110
jcjimenez wants to merge 4 commits into
Azure:masterfrom
jcjimenez:scala_samples

Conversation

@jcjimenez
Copy link
Copy Markdown

I ran into a few issues when trying to get the Cosmos DB connector running in Scala, so this samples project aims to save folks time when starting out. The main issues where:

  1. Adding the azure-cosmosdb-spark_2.2.0_2.11 dependency to my project required tweaking exclusions.

  2. It looks like omitting CosmosDBConfig.ConnectionMode -> "Gateway" from the config map results in a failure (Something like Server could not parse the Url., StatusCode: NotFound).

Comment thread samples/scala/build.sbt
"com.fasterxml.jackson.core" % "jackson-core" % "2.8.3",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.8.3",
"com.fasterxml.jackson.module" % "jackson-module-paranamer" % "2.8.9",
"com.fasterxml.jackson.module" % "jackson-module-scala_2.11" % "2.8.9",
Copy link
Copy Markdown
Author

@jcjimenez jcjimenez Aug 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that before adding these (and the corresponding exclusion above), I was getting an exception citing a conflict in the minor version(s) of jackson modules. I'm happy to file an issue as well as to roll this change into #105

CosmosDBConfig.Masterkey -> sys.env("COSMOS_DB_MASTER_KEY"),
CosmosDBConfig.Database -> "samples",
CosmosDBConfig.Collection -> "airports",
CosmosDBConfig.ConnectionMode -> "Gateway"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that omitting the ConnectionMode entry resulted in an exception like the following:

Caused by: com.microsoft.azure.documentdb.DocumentClientException: Server could not parse the Url., StatusCode: NotFound
	at com.microsoft.azure.documentdb.internal.ErrorUtils.maybeThrowException(ErrorUtils.java:69)
	at com.microsoft.azure.documentdb.internal.GatewayProxy.performGetRequest(GatewayProxy.java:240)
	at com.microsoft.azure.documentdb.internal.GatewayProxy.doReadFeed(GatewayProxy.java:109)
	at com.microsoft.azure.documentdb.internal.GatewayProxy.processMessage(GatewayProxy.java:338)
	at com.microsoft.azure.documentdb.DocumentClient$9.apply(DocumentClient.java:2996)
	at com.microsoft.azure.documentdb.internal.RetryUtility.executeDocumentClientRequest(RetryUtility.java:58)
	at com.microsoft.azure.documentdb.DocumentClient.doReadFeed(DocumentClient.java:3006)
	at com.microsoft.azure.documentdb.DocumentQueryClientInternal.doReadFeed(DocumentQueryClientInternal.java:36)
	at com.microsoft.azure.documentdb.internal.query.AbstractQueryExecutionContext.executeRequest(AbstractQueryExecutionContext.java:215)
	at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.executeOnce(DefaultQueryExecutionContext.java:131)
	at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.fillBuffer(DefaultQueryExecutionContext.java:101)
	at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.next(DefaultQueryExecutionContext.java:84)

@jcjimenez
Copy link
Copy Markdown
Author

cc @khdang @dennyglee

@Azure Azure deleted a comment from msftclas Sep 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants