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

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Strange Map type java.util.Map: cannot determine type parameters #910

Closed
xetra11 opened this issue Oct 19, 2020 · 2 comments
Labels
type: bug Something isn't working

Comments

@xetra11
Copy link
Contributor

xetra11 commented Oct 19, 2020

Library Version
4.0.0-alpha.6

Describe the bug
After introspection I ran my Unit Test to see if the deserialization is working. Unfortunately I came over the a jackson-databind exception. Downgrading the jackson databind library to 2.11.1 is not helping.

To Reproduce

  • Use jackson-databind 2.11.2

Expected behavior
I'd like it to work :)

Additional Information

The dependencies I use

    implementation(platform("org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR8"))
    implementation(platform("org.springframework.cloud:spring-cloud-gcp-dependencies:1.2.5.RELEASE"))

    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
    implementation("com.graphql-java-kickstart:graphql-spring-boot-starter:8.0.0")
    implementation("com.expediagroup:graphql-kotlin-spring-client:4.0.0-alpha.6")

Exception:

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Strange Map type java.util.Map: cannot determine type parameters

I tried to solve this with the mentioned downgrade from: #895

implementation("com.fasterxml.jackson.core:jackson-databind") {
        version {
            strictly("2.11.1")
        }
    }

However this resulted in no mapping happening at all anymore (see my WireMock request stub):

-----------------------------------------------------------------------------------------------------------------------
| Closest stub                                             | Request                                                  |
-----------------------------------------------------------------------------------------------------------------------
                                                           |
POST                                                       | POST
[path] /DG-CODE/graphql                                    | /DG-CODE/graphql
                                                           |
Authorization: JWT-TOKEN                                   |                                                     <<<<< Header is not present
                                                           |
                                                           |
-----------------------------------------------------------------------------------------------------------------------

PS: If there is a better way to unit test the graphql endpoints please let me know!

I am kind of lost in what to do now?

Some extra details to my project:

graphql {
    client {
        allowDeprecatedFields = true
        clientType = GraphQLClientType.WEBCLIENT
        packageName = "com.myapp.network.graphql"
        endpoint = "http://myapp.com/graphql"
    }
}

The logic using the client:

 fun palletProductSearch(distributionGateCode: String): PalletProductSearch.ProductsResponse? {
        val gateUrl = setupDistributionGateUrl(distributionGateCode)
        LOG.info("Executing pallet product query for $gateUrl")
        palletProductSearch = PalletProductSearch(GraphQLWebClient(gateUrl))
        var result: PalletProductSearch.Result? = null
        runBlocking {
            palletProductSearch.execute() {
                header(HttpHeaders.AUTHORIZATION, extractAuthorizationFromRequest())
            }
            val execute = palletProductSearch.execute()
            execute.errors?.forEach { error -> LOG.error(error.message) }
            result = execute.data
        }
        return result?.productsearch
    }
@xetra11 xetra11 added the type: bug Something isn't working label Oct 19, 2020
@dariuszkuc
Copy link
Collaborator

As was mentioned in #895 and #850 it is an issue with Jackson 2.11.2. You can either downgrade to 2.11.1 or upgrade to 2.11.3.

I am unsure what would be causing your wiremock configuration issue - based on the error it says that your stubbed endpoint requires auth header but your request does not specify it. Check whether extractAuthorizationFromRequest is populating the header.

@xetra11
Copy link
Contributor Author

xetra11 commented Oct 20, 2020

Sorry maybe you are right and I screwed up something with WireMock. It just worked beforehand before I started to migrate to GraphQL Kotlin. Sorry for the impatience

@xetra11 xetra11 closed this as completed Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Development

No branches or pull requests

2 participants