Skip to content

graphql-java 4.1 compatibility #40

Closed

Description

@soudmaijer

Servlet project is completely broken for graphql-java 4.1.

Caused by: java.lang.NoClassDefFoundError: graphql/execution/TypeInfo
	at graphql.servlet.GraphQLServlet.<clinit>(GraphQLServlet.java:78) ~[graphql-java-servlet-4.2.1.jar:na]

And the graphql.servlet.DefaultExecutionStrategyProvider cannot find:

Caused by: java.lang.ClassNotFoundException: graphql.execution.SimpleExecutionStrategy

For me it is working again with the following changes: soudmaijer@767e318

But there is a failing test, I have no clue why that one is failing (yet).

Activity

  1. jwalgemoed commented on Sep 5, 2017

    @jwalgemoed

    Temporary workaround is adding this code to remap some of the moved classes. The servlet expects a SimpleExecutionStrategy inside the graphql.execution package, so I created one that's extending the AsyncExecutionStrategy.

    The TypeInfo class was also moved, so add that one too extending the class in its new location. This should allow bootstrapping to continue until the servlet is successfully patched.

    If you're wondering why the AsyncExecutionStrategy was chosen in this example, see here: graphql-java/graphql-java#590. Quote:

    SimpleExecutionStrategy is now SerialExecutionStrategy and is not used anymore by default, because it is blocking.

    The new default strategy is AsyncExecutionStrategy for queries and AsyncSerialExecutionStrategy for mutations. Both are non blocking but are compatible to the old behaviour if DataFetcher are still blocking and not async.

    Of course, you could easily extend from another strategy class if that makes sense for your use case. Code is in Kotlin.

    package graphql.execution
    
    import graphql.language.Type
    import graphql.schema.idl.TypeInfo
    
    class SimpleExecutionStrategy: AsyncExecutionStrategy()
    
    class TypeInfo(val type: Type) : TypeInfo(type)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions