Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sbt-based project for Scala samples #110

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Added sbt-based project for Scala samples #110

wants to merge 4 commits into from

Conversation

jcjimenez
Copy link

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).

"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
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
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
Author

cc @khdang @dennyglee

@Azure Azure deleted a comment from msftclas Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants