Comments (19)
Spring 3.X only works with Elide 7 onwards.
from elide.
I tried Elide 7, but it still doesn't work. Is there any newer elide-spring-boot-starter which compatible with 3.x?
from elide.
11-03-2023 11:57:05.857 [restartedMain] ERROR SpringApplication.reportFailure - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.yahoo.elide.spring.controllers.JsonApiController' defined in BeanDefinition defined in null: Unexpected AOP exception
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:606)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:310)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293)
at gov.nih.gov.ncats.ifx.pounce.PounceApiApplication.main(PounceApiApplication.java:12)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception
at org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:222)
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:158)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
at org.springframework.aop.scope.ScopedProxyFactoryBean.setBeanFactory(ScopedProxyFactoryBean.java:115)
at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.setBeanFactory(GenericScope.java:448)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1783)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1750)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
... 20 common frames omitted
Caused by: java.lang.ClassCastException: class com.yahoo.elide.spring.controllers.JsonApiController$$SpringCGLIB$$0 cannot be cast to class org.springframework.cglib.proxy.Factory (com.yahoo.elide.spring.controllers.JsonApiController$$SpringCGLIB$$0 and org.springframework.cglib.proxy.Factory are in unnamed module of loader 'app')
at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:91)
at org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:213)
... 27 common frames omitted
from elide.
from elide.
I tried but got error: Could not find artifact com.yahoo.elide:elide-spring-boot-starter:jar:7.0.0-RC7-SNAPSHOT
(Could not find artifact com.yahoo.elide:elide-spring-boot-starter:jar:7.0.0-RC7-SNAPSHOT in com.yahoo.elide (https://github.com/yahoo/elide/tree/elide-7.x/elide-spring/elide-spring-boot-starter))
Any suggestions and pom.xml examples are highly appreciated!
from elide.
from elide.
@aklish I used latest version 7.0.0-pr2 in https://mvnrepository.com/artifact/com.yahoo.elide/elide-core, but still got error:
Caused by: java.lang.ClassCastException: class com.yahoo.elide.spring.controllers.JsonApiController$$SpringCGLIB$$0 cannot be cast to class org.springframework.cglib.proxy.Factory (com.yahoo.elide.spring.controllers.JsonApiController$$SpringCGLIB$$0 and org.springframework.cglib.proxy.Factory are in unnamed module of loader 'app')
at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:91)
at org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:213)
... 27 common frames omitted
from elide.
from elide.
We're unable to move forward until this problem is resolved, I really appreciate your help!
from elide.
from elide.
I didn't investigate this fully but this seems to be caused by Spring Boot Dev Tools and the fact that the controllers are annotated @Configuration
which also creates a proxy by default. I don't think that the @Configuration
annotations on the controllers are necessary and removing them seems to solve the issue.
If you need a quick fix removing Spring Boot Dev Tools also makes the problem go away.
from elide.
Thank you so much @justin-tay . After removing Spring Boot Dev Tools, I got another error:
required a bean of type 'com.yahoo.elide.graphql.QueryRunners' that could not be found.
Action:
Consider defining a bean of type 'com.yahoo.elide.graphql.QueryRunners' in your configuration.
We are eagerly awaiting your new release. I have developed a strong affinity for Elide, and would prefer not to part ways with it as we embark on our new project. Thank you again!
from elide.
Are you using the code at https://github.com/yahoo/elide-spring-boot-example/tree/elide-7.x to test?
You should have that bean in @RefreshScope
if elide.graphql.enabled
is set to true
.
from elide.
So I tried 3.0.4 spring tonight with the elide-7.x branch of the elide-spring-boot-example repo. I wasn't able to reproduce this problem. The project launched and everything seems to check out fine. I bumped the elide-7.x branch to now use 3.0.4 spring.
I suspect there is something else going on with your pom that is different than the example project?
from elide.
@aklish and @justin-tay , thank you so much for your assistance! Could you please review the following code snippet (Springboot 3.0.4 and Elide 7.0.0-pr2, the GraphqlController used for intercepting the incoming requests), as well as the error message below? I would greatly appreciate any suggestions you may have.
Parameter 0 of constructor in a.b.c.GraphqlController required a bean of type 'com.yahoo.elide.graphql.QueryRunners' that could not be found.
Action: Consider defining a bean of type 'com.yahoo.elide.graphql.QueryRunners' in your configuration.
@Hidden
@RefreshScope
@Configuration
@RestController
@RequestMapping(value = "${elide.graphql.path}")
@ConditionalOnExpression("!${elide.graphql.enabled}")
@EnableConfigurationProperties(ElideConfigProperties.class)
public class GraphqlController {
private final QueryRunners runners;
private final ElideConfigProperties settings;
private final HeaderUtils.HeaderProcessor headerProcessor;
@Autowired
public GraphqlController(QueryRunners runners, JsonApiMapper jsonApiMapper,
HeaderUtils.HeaderProcessor headerProcessor, ElideConfigProperties settings) {
this.runners = runners;
this.settings = settings;
this.headerProcessor = headerProcessor;
}
}
from elide.
I think it would be helpful to understand what you are trying to do as that snippet looks a little different from the one from the auto configuration. The auto configuration will already take care of creating the GraphqlController
so are you attempting to define your own? If you aren't using the example at https://github.com/yahoo/elide-spring-boot-example/tree/elide-7.x then a small reproducer project would be easier to understand.
The message just says you are missing a com.yahoo.elide.graphql.QueryRunners
in the application context.
If you were using the ElideAutoConfiguration
this should have been automatically created for you
from elide.
Our GraphqlController intercepts GraphQL queries for logging. monitoring, security etc. We discovered that on the Dev environment, the configuration file had mistakenly set 'elide.graphql.enabled' to false. After correcting this, the issue was resolved. Thank you very much for your assistance!
Go Elied!
from elide.
Looking at the @ConditionalOnExpression("!${elide.graphql.enabled}")
annotation on your custom GraphqlController
setting elide.graphql.enabled
to true
enabled the default auto configuration GraphqlController
but disabled your custom GraphqlController
.
You might want to consider leaving it as false
and just setting your own configuration for QueryRunners
.
@Configuration
public class GraphqlConfiguration {
@Bean
@RefreshScope
public QueryRunners getQueryRunners(RefreshableElide refreshableElide) {
return new QueryRunners(refreshableElide);
}
}
from elide.
Great idea! Thank you @justin-tay
from elide.
Related Issues (20)
- Confusing exception message while using ISO8601DateSerde and epoch date in filter
- Authorization on Swagger UI HOT 2
- Any `CustomErrorException`s thrown within custom code are automatically converted to `WebApplicationException` which discards all error objects HOT 10
- JSON API Atomic Operations support
- Spring Boot 3 Native Image support HOT 5
- Is it possible to filter by json fields? HOT 9
- Cannot traverse more than one level up a graph HOT 9
- Overriding `DataFetcherExceptionHandler` has no effect HOT 5
- JSON Patch Operation Read Permission Issue HOT 2
- Does Elide support "speed" (average over date) measure? HOT 1
- "no transaction is in progress" with spring boot and 7.0.0 pr5 HOT 2
- OpenAPIBuilder removes paths for relationships that are 3 levels deep. (7.0.0pr5)
- Generated OAS incorrectly sets objects as nodes
- elide-spring-boot-starter:7.0.0-pr5 doesn't work with spring boot 3.1.1 HOT 5
- CVE-2023-34620 - HJson vulnerability. HOT 2
- Attempting to deploy standalone Elide WAR app results in "java.lang.IllegalStateException: No Jetty ContextHandler, Jakarta WebSocket SCI unavailable" HOT 2
- Is two-phase binding mandatory? HOT 3
- Elide 7.x Release schedule HOT 8
- Aggregation data store with json fields
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elide.