graphql-java-annotations icon indicating copy to clipboard operation
graphql-java-annotations copied to clipboard

Does not work with graphql com.graphql-java:graphql-java:2019-10-25T08-51-57-a634053

Open shevek opened this issue 5 years ago • 2 comments

java.lang.NoSuchMethodError: graphql.schema.GraphQLType.getName()Ljava/lang/String
        at graphql.annotations.processor.retrievers.GraphQLTypeRetriever.getGraphQLType(GraphQLTypeRetriever.java:97)
        at graphql.annotations.processor.graphQLProcessors.GraphQLOutputProcessor.getOutputTypeOrRef(GraphQLOutputProcessor.java:44)
        at graphql.annotations.processor.typeFunctions.ObjectFunction.buildType(ObjectFunction.java:55)
        at graphql.annotations.processor.typeFunctions.DefaultTypeFunction.buildType(DefaultTypeFunction.java:104)
        at graphql.annotations.processor.retrievers.fieldBuilders.method.MethodTypeBuilder.build(MethodTypeBuilder.java:52)
        at graphql.annotations.processor.retrievers.GraphQLFieldRetriever.getField(GraphQLFieldRetriever.java:77)
        at graphql.annotations.processor.typeBuilders.OutputObjectBuilder.getOutputObjectBuilder(OutputObjectBuilder.java:81)
        at graphql.annotations.processor.retrievers.GraphQLTypeRetriever.getGraphQLType(GraphQLTypeRetriever.java:86)
        at graphql.annotations.processor.graphQLProcessors.GraphQLOutputProcessor.getOutputTypeOrRef(GraphQLOutputProcessor.java:44)
        at graphql.annotations.processor.typeFunctions.ObjectFunction.buildType(ObjectFunction.java:55)
        at graphql.annotations.processor.typeFunctions.DefaultTypeFunction.buildType(DefaultTypeFunction.java:104)
        at graphql.annotations.processor.retrievers.fieldBuilders.method.MethodTypeBuilder.build(MethodTypeBuilder.java:52)
        at graphql.annotations.processor.retrievers.GraphQLFieldRetriever.getField(GraphQLFieldRetriever.java:77)
        at graphql.annotations.processor.typeBuilders.OutputObjectBuilder.getOutputObjectBuilder(OutputObjectBuilder.java:81)
        at graphql.annotations.processor.retrievers.GraphQLTypeRetriever.getGraphQLType(GraphQLTypeRetriever.java:86)
        at graphql.annotations.processor.retrievers.GraphQLObjectHandler.getGraphQLType(GraphQLObjectHandler.java:32)
        at graphql.annotations.processor.GraphQLAnnotations.object(GraphQLAnnotations.java:124)

shevek avatar Oct 25 '19 22:10 shevek

I don't understand this issue. What does not work? What did you try to do?

yarinvak avatar Nov 04 '19 20:11 yarinvak

I suspect he did the same thing as me. Our stack traces are identical.

I followed this tutorial: https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/

But tried to use the annotations to generate the schema instead, resulting in something like this:

public class Hello {
  @GraphQLField
  private String value;

  // constructor, getters but no setters
}
@GraphQLName("query")
public class HelloQuery {
  @GraphQLField
  public static Hello getHello(DataFetchingEnvironment env) {
    return new Hello("world");
  }
}
@Component
public class GraphQLProvider {
  private GraphQL graphQL;

  @Bean
  public GraphQL graphQL() {
    return graphQL;
  }

  @PostConstruct
  public void init() {
    GraphQLSchema graphQLSchema = AnnotationsSchemaCreator.newAnnotationsSchema()
        .query(HelloQuery.class)
        .typeFunction(new DefaultTypeFunction())
        .build();
    this.graphQL = GraphQL.newGraphQL(graphQLSchema).build();
  }
}

error on ".build()"

alle7522 avatar Nov 05 '19 15:11 alle7522

Hi @shevek ,

We're helping with project maintenance and reviewing the list of opened PRs and Issues.

This issue was created quite a while ago, we were wondering if you were still interested in the outcome, please let us know if this is the case.

Without an answer by July 1st, 2023, this issue will be closed as "inactive" (and can always be re-opened later on if needed).

Thanks,

Fgerthoffert avatar Jun 02 '23 08:06 Fgerthoffert