You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding is that this project wants to allow easy use of existing POJOs in your query classes, and the PropertyDataFetcher is providing this support. I've got some POJOs from a third-party developer that used public attributes rather than accessors, and as a result the getPropertyViaGetter method would fail to resolve the properties every time. It seems like it would be easy enough to add a getPropertyAsAttribute method that could execute when this one failed in order to support such POJOs.
I then got my third-party developer to generate accessors for all of the properties in the POJOs and found another problem. They added serialVersionUIDs as private static members (which I think is a pretty standard approach) as follows:
private static final long serialVersionUID = 1L;
This leads to an exception stack trace something like this because the serialVersionUID field is not accessible when building the schema, and I'm not sure what to do about that exactly...could be that adding an addFieldFilterPredicates or similar method to the schema config class would allow clients to further filter the fields returned by the Class.getDeclaredFields method in ReflectionUtils so that we can limit it somehow, or possibly just adding by default a predicate that only includes public fields. I'm not familiar enough with how this code is working to really make recommendations here, but is there a way to not get this exception when trying to build a schema off of something that has private fields?
...
Caused by: java.lang.IllegalStateException: Could not access method: Class org.springframework.util.ReflectionUtils can not access a member of class <X.Y.Z.PojoClass> with modifiers "private static final"
at org.springframework.util.ReflectionUtils.handleReflectionException(ReflectionUtils.java:277)
at org.springframework.util.ReflectionUtils.getField(ReflectionUtils.java:146)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.getFieldDefinition(GraphQLSchemaDfsTraversal.java:293)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.lambda$createGraphQLObjectTypeRecursively$1(GraphQLSchemaDfsTraversal.java:142)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal$$Lambda$8/1734769274.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLObjectTypeRecursively(GraphQLSchemaDfsTraversal.java:141)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLFieldType(GraphQLSchemaDfsTraversal.java:317)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.getFieldDefinition(GraphQLSchemaDfsTraversal.java:284)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.lambda$createGraphQLObjectTypeRecursively$1(GraphQLSchemaDfsTraversal.java:142)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal$$Lambda$8/1734769274.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLObjectTypeRecursively(GraphQLSchemaDfsTraversal.java:141)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLFieldType(GraphQLSchemaDfsTraversal.java:317)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.getFieldDefinition(GraphQLSchemaDfsTraversal.java:284)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.lambda$createGraphQLObjectTypeRecursively$1(GraphQLSchemaDfsTraversal.java:142)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal$$Lambda$8/1734769274.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLObjectTypeRecursively(GraphQLSchemaDfsTraversal.java:141)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLFieldType(GraphQLSchemaDfsTraversal.java:317)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.getMethodDefinition(GraphQLSchemaDfsTraversal.java:252)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.lambda$createGraphQLObjectTypeRecursively$2(GraphQLSchemaDfsTraversal.java:148)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal$$Lambda$9/105622200.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLObjectTypeRecursively(GraphQLSchemaDfsTraversal.java:147)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.findSchemaQueryRoot(GraphQLSchemaDfsTraversal.java:120)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.traverse(GraphQLSchemaDfsTraversal.java:100)
at com.oembedler.moon.graphql.engine.GraphQLSchemaBuilder.buildSchema(GraphQLSchemaBuilder.java:51)
at <XYZ.SchemaConfiguration>.graphQLSchemaHolder(SchemaConfiguration.java:55)
at <XYZ.SchemaConfiguration$$EnhancerBySpringCGLIB$$3c229244.CGLIB$graphQLSchemaHolder$2()
at <XYZ.SchemaConfiguration>$$EnhancerBySpringCGLIB$$3c229244$$FastClassBySpringCGLIB$$4ac22a24.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
at <XYZ.SchemaConfiguration>$$EnhancerBySpringCGLIB$$3c229244.graphQLSchemaHolder()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 42 more
The text was updated successfully, but these errors were encountered:
My understanding is that this project wants to allow easy use of existing POJOs in your query classes, and the PropertyDataFetcher is providing this support. I've got some POJOs from a third-party developer that used public attributes rather than accessors, and as a result the getPropertyViaGetter method would fail to resolve the properties every time. It seems like it would be easy enough to add a getPropertyAsAttribute method that could execute when this one failed in order to support such POJOs.
I then got my third-party developer to generate accessors for all of the properties in the POJOs and found another problem. They added serialVersionUIDs as private static members (which I think is a pretty standard approach) as follows:
private static final long serialVersionUID = 1L;
This leads to an exception stack trace something like this because the serialVersionUID field is not accessible when building the schema, and I'm not sure what to do about that exactly...could be that adding an addFieldFilterPredicates or similar method to the schema config class would allow clients to further filter the fields returned by the Class.getDeclaredFields method in ReflectionUtils so that we can limit it somehow, or possibly just adding by default a predicate that only includes public fields. I'm not familiar enough with how this code is working to really make recommendations here, but is there a way to not get this exception when trying to build a schema off of something that has private fields?
...
Caused by: java.lang.IllegalStateException: Could not access method: Class org.springframework.util.ReflectionUtils can not access a member of class <X.Y.Z.PojoClass> with modifiers "private static final"
at org.springframework.util.ReflectionUtils.handleReflectionException(ReflectionUtils.java:277)
at org.springframework.util.ReflectionUtils.getField(ReflectionUtils.java:146)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.getFieldDefinition(GraphQLSchemaDfsTraversal.java:293)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.lambda$createGraphQLObjectTypeRecursively$1(GraphQLSchemaDfsTraversal.java:142)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal$$Lambda$8/1734769274.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLObjectTypeRecursively(GraphQLSchemaDfsTraversal.java:141)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLFieldType(GraphQLSchemaDfsTraversal.java:317)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.getFieldDefinition(GraphQLSchemaDfsTraversal.java:284)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.lambda$createGraphQLObjectTypeRecursively$1(GraphQLSchemaDfsTraversal.java:142)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal$$Lambda$8/1734769274.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLObjectTypeRecursively(GraphQLSchemaDfsTraversal.java:141)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLFieldType(GraphQLSchemaDfsTraversal.java:317)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.getFieldDefinition(GraphQLSchemaDfsTraversal.java:284)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.lambda$createGraphQLObjectTypeRecursively$1(GraphQLSchemaDfsTraversal.java:142)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal$$Lambda$8/1734769274.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLObjectTypeRecursively(GraphQLSchemaDfsTraversal.java:141)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLFieldType(GraphQLSchemaDfsTraversal.java:317)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.getMethodDefinition(GraphQLSchemaDfsTraversal.java:252)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.lambda$createGraphQLObjectTypeRecursively$2(GraphQLSchemaDfsTraversal.java:148)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal$$Lambda$9/105622200.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.createGraphQLObjectTypeRecursively(GraphQLSchemaDfsTraversal.java:147)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.findSchemaQueryRoot(GraphQLSchemaDfsTraversal.java:120)
at com.oembedler.moon.graphql.engine.dfs.GraphQLSchemaDfsTraversal.traverse(GraphQLSchemaDfsTraversal.java:100)
at com.oembedler.moon.graphql.engine.GraphQLSchemaBuilder.buildSchema(GraphQLSchemaBuilder.java:51)
at <XYZ.SchemaConfiguration>.graphQLSchemaHolder(SchemaConfiguration.java:55)
at <XYZ.SchemaConfiguration$$EnhancerBySpringCGLIB$$3c229244.CGLIB$graphQLSchemaHolder$2()
at <XYZ.SchemaConfiguration>$$EnhancerBySpringCGLIB$$3c229244$$FastClassBySpringCGLIB$$4ac22a24.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
at <XYZ.SchemaConfiguration>$$EnhancerBySpringCGLIB$$3c229244.graphQLSchemaHolder()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 42 more
The text was updated successfully, but these errors were encountered: