Skip to content

Weld Proxy - List Error #208

Closed
Closed

Description

@DragontaleStudio

Hello,

I have been using the library along with Weld CDI and came up on the error:

Caused by: com.coxautodev.graphql.tools.SchemaClassScannerError: Unable to match type definition (ListType{type=TypeName{name='Ranking'}}) with java type (class [Lgameefy.graphql.Ranking;): Java class is not a List or generic type information was lost: class [Lgameefy.graphql.Ranking;

I tried creating a proxy similar to the Guice one without any luck.

public class WeldProxyHandler implements ProxyHandler
{
    @Override
    public boolean canHandle(GraphQLResolver<?> resolver) {
        return isWeldProxy(resolver);
    }

    @Override
    public Class<?> getTargetClass(GraphQLResolver<?> resolver) {
        return resolver.getClass().getSuperclass();
    }

    private boolean isWeldProxy(GraphQLResolver<?> resolver) {
        return resolver.getClass().getName().contains("$Proxy$_$$_WeldClientProxy");
    }
}

I also put the newly WeldProxyHandler under proxy list on SchemaParserBuilder.

Is anything more I am missing?

Activity

  1. DragontaleStudio commented on Nov 21, 2018

    @DragontaleStudio
    Author

    Guys it is actually working. 👍

    Yesterday during all the trials and errors I forgotten the actual method.
    I was testing with:

    public Ranking[] getAllRankings()

    Rolling it back to List<Ranking>, made it work.

    I can create a pull request with relevant changes.

    Thanks

  2. oliemansm commented on Nov 21, 2018

    @oliemansm
    Member

    @DragontaleStudio Seeing you're mentioning a PR you made some changes in graphql-java-tools to make it work again for you? Then could you indeed share that PR?

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions