I am trying to use Camel CDI dependency in a Quarkus project for its transaction policy implementation. But Quarkus crashed at startup with that dependecy.
implementation 'org.apache.camel:camel-cdi:3.2.0'
It seems that Quarkus Arc is trying to resolve the bean provided by the class
org.apache.camel.cdi.CdiCamelExtension
But I do not need it. My application does not use the provided dependencie.
How can I exclude such factories from Quarkus Arc processing?
Stacktrace:
Caused by: javax.enterprise.inject.spi.DeploymentException: Found 8 deployment problems:
[1] Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#typeConverter()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.TypeConverter, java.lang.Object], qualifiers=[#Default, #Any], target=org.apache.camel.TypeConverter typeConverter(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
[2] Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#mockEndpointFromUri()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.component.mock.MockEndpoint, java.lang.Object], qualifiers=[#Uri(value = ""), #Any], target=org.apache.camel.component.mock.MockEndpoint mockEndpointFromUri(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
[3] Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#producerTemplate()
- declared on PRODUCER METHOD bean [types=[java.lang.AutoCloseable, org.apache.camel.ProducerTemplate, java.lang.Object, org.apache.camel.Service], qualifiers=[#Default, #Uri(value = ""), #Any], target=org.apache.camel.ProducerTemplate producerTemplate(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
[4] Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#consumerTemplate()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.ConsumerTemplate, java.lang.AutoCloseable, java.lang.Object, org.apache.camel.Service], qualifiers=[#Default, #Any], target=org.apache.camel.ConsumerTemplate consumerTemplate(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
[5] Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#endpoint()
- declared on PRODUCER METHOD bean [types=[java.lang.AutoCloseable, org.apache.camel.IsSingleton, java.lang.Object, org.apache.camel.Endpoint, org.apache.camel.Service], qualifiers=[#Uri(value = ""), #Any], target=org.apache.camel.Endpoint endpoint(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
[6] Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#mockEndpointFromMember()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.component.mock.MockEndpoint, java.lang.Object], qualifiers=[#Default, #Any], target=org.apache.camel.component.mock.MockEndpoint mockEndpointFromMember(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
[7] Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#fluentProducerTemplate()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.FluentProducerTemplate, java.lang.AutoCloseable, java.lang.Object, org.apache.camel.Service], qualifiers=[#Default, #Uri(value = ""), #Any], target=org.apache.camel.FluentProducerTemplate fluentProducerTemplate(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
[8] Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#cdiEventEndpoint()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.CamelContextAware, org.apache.camel.support.DefaultEndpoint, org.apache.camel.IsSingleton, org.apache.camel.support.service.ServiceSupport, org.apache.camel.ShutdownableService, org.apache.camel.cdi.CdiEventEndpoint<T>, java.lang.Object, org.apache.camel.SuspendableService, org.apache.camel.Endpoint, org.apache.camel.Service, org.apache.camel.StatefulService, java.lang.AutoCloseable, org.apache.camel.support.service.BaseService, org.apache.camel.spi.HasId], qualifiers=[#Default, #Any], target=org.apache.camel.cdi.CdiEventEndpoint<T> cdiEventEndpoint(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension, javax.enterprise.event.Event<java.lang.Object> event) throws java.lang.Exception, declaringBean=org.apache.camel.cdi.CdiCamelFactory]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:981)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:240)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:135)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:358)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:931)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#typeConverter()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.TypeConverter, java.lang.Object], qualifiers=[#Default, #Any], target=org.apache.camel.TypeConverter typeConverter(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:232)
... 14 more
Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#mockEndpointFromUri()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.component.mock.MockEndpoint, java.lang.Object], qualifiers=[#Uri(value = ""), #Any], target=org.apache.camel.component.mock.MockEndpoint mockEndpointFromUri(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:232)
... 14 more
Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#producerTemplate()
- declared on PRODUCER METHOD bean [types=[java.lang.AutoCloseable, org.apache.camel.ProducerTemplate, java.lang.Object, org.apache.camel.Service], qualifiers=[#Default, #Uri(value = ""), #Any], target=org.apache.camel.ProducerTemplate producerTemplate(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:232)
... 14 more
Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#consumerTemplate()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.ConsumerTemplate, java.lang.AutoCloseable, java.lang.Object, org.apache.camel.Service], qualifiers=[#Default, #Any], target=org.apache.camel.ConsumerTemplate consumerTemplate(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:232)
... 14 more
Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#endpoint()
- declared on PRODUCER METHOD bean [types=[java.lang.AutoCloseable, org.apache.camel.IsSingleton, java.lang.Object, org.apache.camel.Endpoint, org.apache.camel.Service], qualifiers=[#Uri(value = ""), #Any], target=org.apache.camel.Endpoint endpoint(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:232)
... 14 more
Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#mockEndpointFromMember()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.component.mock.MockEndpoint, java.lang.Object], qualifiers=[#Default, #Any], target=org.apache.camel.component.mock.MockEndpoint mockEndpointFromMember(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:232)
... 14 more
Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#fluentProducerTemplate()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.FluentProducerTemplate, java.lang.AutoCloseable, java.lang.Object, org.apache.camel.Service], qualifiers=[#Default, #Uri(value = ""), #Any], target=org.apache.camel.FluentProducerTemplate fluentProducerTemplate(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension), declaringBean=org.apache.camel.cdi.CdiCamelFactory]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:232)
... 14 more
Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.apache.camel.cdi.CdiCamelExtension and qualifiers [#Default]
- java member: org.apache.camel.cdi.CdiCamelFactory#cdiEventEndpoint()
- declared on PRODUCER METHOD bean [types=[org.apache.camel.CamelContextAware, org.apache.camel.support.DefaultEndpoint, org.apache.camel.IsSingleton, org.apache.camel.support.service.ServiceSupport, org.apache.camel.ShutdownableService, org.apache.camel.cdi.CdiEventEndpoint<T>, java.lang.Object, org.apache.camel.SuspendableService, org.apache.camel.Endpoint, org.apache.camel.Service, org.apache.camel.StatefulService, java.lang.AutoCloseable, org.apache.camel.support.service.BaseService, org.apache.camel.spi.HasId], qualifiers=[#Default, #Any], target=org.apache.camel.cdi.CdiEventEndpoint<T> cdiEventEndpoint(javax.enterprise.inject.spi.InjectionPoint ip, javax.enterprise.inject.Instance<org.apache.camel.CamelContext> instance, org.apache.camel.cdi.CdiCamelExtension extension, javax.enterprise.event.Event<java.lang.Object> event) throws java.lang.Exception, declaringBean=org.apache.camel.cdi.CdiCamelFactory]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:232)
... 14 more
There is no way to do that currently, although I can see why it might be useful.
Feel free to open a GitHub issue where we can discuss the request
I am trying to pointcut every db connection before any user access and do business operations on database and write client_info as username to db. With this way i would know who executed the sql on database side.
This is my Aspect;
#Aspect
#Component
public class ConnectionAspect {
#Around("execution(java.sql.Connection javax.sql.DataSource.getConnection(..))")
public Object proxyConnection(ProceedingJoinPoint joinPoint) throws Throwable {
Object result = joinPoint.proceed();
setClientInfo(result, false);
return result;
}
}
When i run the code in development server it works and there is no problem. ( With In tomcat and application side datasource )
But when i run in the test server ( With in the JBoss and ApplicationServer based datasource ) the application do not start and gives the exception below ( Jboss Logs )
2019-12-26 10:47:07,030 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 124) MSC000001: Failed to start service jboss.deployment.unit."myproject.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.unit."myproject.war".undertow-deployment: java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditEventsEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfiguration.class]: Unsatisfied dependency expressed through method 'auditEventsEndpoint' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customAuditEventRepository' defined in VFS resource ["/content/myproject.war/WEB-INF/classes/tr/com/aurora/myproject/repository/CustomAuditEventRepository.class"]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceAuditEventRepository': Cannot create inner bean '(inner bean)#661945d5' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#661945d5': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liquibase' defined in class path resource [tr/com/aurora/myproject/config/LiquibaseConfiguration.class]: Unsatisfied dependency expressed through method 'liquibase' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.jboss.as.connector.subsystems.datasources.WildFlyDataSource: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditEventsEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfiguration.class]: Unsatisfied dependency expressed through method 'auditEventsEndpoint' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customAuditEventRepository' defined in VFS resource ["/content/myproject.war/WEB-INF/classes/tr/com/aurora/myproject/repository/CustomAuditEventRepository.class"]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceAuditEventRepository': Cannot create inner bean '(inner bean)#661945d5' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#661945d5': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liquibase' defined in class path resource [tr/com/aurora/myproject/config/LiquibaseConfiguration.class]: Unsatisfied dependency expressed through method 'liquibase' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.jboss.as.connector.subsystems.datasources.WildFlyDataSource: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78)
... 8 more
Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditEventsEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfiguration.class]: Unsatisfied dependency expressed through method 'auditEventsEndpoint' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customAuditEventRepository' defined in VFS resource ["/content/myproject.war/WEB-INF/classes/tr/com/aurora/myproject/repository/CustomAuditEventRepository.class"]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceAuditEventRepository': Cannot create inner bean '(inner bean)#661945d5' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#661945d5': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liquibase' defined in class path resource [tr/com/aurora/myproject/config/LiquibaseConfiguration.class]: Unsatisfied dependency expressed through method 'liquibase' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.jboss.as.connector.subsystems.datasources.WildFlyDataSource: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:157)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:137)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:203)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:185)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#661945d5': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liquibase' defined in class path resource [tr/com/aurora/myproject/config/LiquibaseConfiguration.class]: Unsatisfied dependency expressed through method 'liquibase' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.jboss.as.connector.subsystems.datasources.WildFlyDataSource: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:378)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:626)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:445)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:312)
... 100 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liquibase' defined in class path resource [tr/com/aurora/myproject/config/LiquibaseConfiguration.class]: Unsatisfied dependency expressed through method 'liquibase' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.jboss.as.connector.subsystems.datasources.WildFlyDataSource: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:733)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:475)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:367)
... 108 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.jboss.as.connector.subsystems.datasources.WildFlyDataSource: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:819)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:725)
... 120 more
Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.jboss.as.connector.subsystems.datasources.WildFlyDataSource: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:208)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:473)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:355)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:304)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573)
... 130 more
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:345)
at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:492)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291)
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:480)
at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:337)
at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:58)
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:205)
... 137 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:459)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
... 150 more
Caused by: java.lang.NoClassDefFoundError: org/jboss/as/connector/subsystems/datasources/WildFlyDataSource
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
... 155 more
Caused by: java.lang.ClassNotFoundException: org.jboss.as.connector.subsystems.datasources.WildFlyDataSource from [Module "deployment.myproject.war" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 157 more
I have a spring boot application and using hibernate. My application works on tomcat in development server and works on Jboss on test server. So in development server i m creating datasource on application side but in the test server i m using jboss's pre created datasource with jndi name.
Library and application versions
Spring boot : 2.0.8.RELEASE
Hibernate : 5.2.17.Final
Jboss : 14.0.11.Final-redhat-00001
Oracle
Edit
My Jboss DataSource configuration in domain.xml profile ha;
<datasources>
<datasource jndi-name="java:/OracleDS" pool-name="OracleDevDS" statistics-enabled="true">
<connection-url>jdbc:oracle:thin:#10.0.0.150:1521:myProjectSchema</connection-url>
<driver>OracleDriver</driver>
<pool>
<min-pool-size>5</min-pool-size>
<initial-pool-size>5</initial-pool-size>
<max-pool-size>150</max-pool-size>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
<security>
<user-name>***</user-name>
<password>***</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
<background-validation>true</background-validation>
<stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
</validation>
</datasource>
<drivers>
<driver name="OracleDriver" module="com.oracle"/>
</drivers>
</datasources>
Oracle driver declaration in com/oracle/module.xml
<module xmlns="urn:jboss:module:1.0" name="com.oracle">
<resources>
<resource-root path="ojdbc8.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
No one is answered this question and some others having same issue so i answered my own question. By the way it is a work around, i didn't found any solution to pointcut the jbosses datasource.
The problem is jboss using its own library to create datasource in its context and the default library of jboss is build using cglib proxy. Spring does not use cglib proxies as default. So springs proxy and jbosses proxy is conflicting.
I did not try to build my project using cglib proxies because devops process was not in my opinion.
So i did my job with aspecting the entity manager create method not the datasource create metod. Because entity manager is declared in my project and it is in control of spring.
Note: The entity manager is created once in a session but an entity manager is not restricted to use only one db connection. Entity manager uses the connection taken from the connection pool. BUT Jboss gives only one connection to one request. So it is same to point cut the connection create metod and entity manager ( session ) create metod.
There is my aspect
#Aspect
#Component
public class DbUserAspect {
#Around("execution(javax.persistence.EntityManager javax.persistence.EntityManagerFactory.createEntityManager(..))")
public Object proxyConnection(ProceedingJoinPoint joinPoint) throws Throwable {
EntityManager result = (EntityManager) joinPoint.proceed();
if (SecurityUtils.getCurrentUser() != null) {
setClientInfo(result, false);
return createDbUserRemoveProxy(result);
}
return result;
}
private Object createDbUserRemoveProxy(EntityManager entityManager) {
return Proxy.newProxyInstance(
EntityManager.class.getClassLoader(),
new Class[]{EntityManager.class},
(proxy, method, args) -> {
if (method.getName().equals("close")) {
setClientInfo(entityManager, true);
}
return method.invoke(entityManager, args);
}
);
}
private void setClientInfo(EntityManager entityManager, boolean isClean) {
Query query;
try {
query = entityManager.createNativeQuery("begin dbms_application_info.set_client_info(?); end;");
if (!isClean) {
query.setParameter(1, SecurityUtils.getCurrentUser().getUsername());
System.out.println("Connection : " + entityManager.hashCode() + " SET");
} else {
query.setParameter(1, null);
System.out.println("Connection : " + entityManager.hashCode() + " CLEAN");
}
query.executeUpdate();
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
}
I was trying to create a hello world with JNoSQL, Mongo and Wildfly Swarm.
The use #Inject of DocumentCollectionManager is working, but it is not working with a Repository.
This is how I'm injecting:
#Inject
private DocumentCollectionManager entityManager; // works
#Inject
#Database(DatabaseType.DOCUMENT)
private UserRepository userRepository; // do not work!
This is how I configured the producer:
#ApplicationScoped
public class MongoProducer {
private static final String DATABASE = "db";
#Inject
#ConfigurationUnit(name = "document", fileName = "jnosql.yaml")
private DocumentCollectionManagerFactory<MongoDBDocumentCollectionManager> entityManager;
#Produces
#Database(DatabaseType.DOCUMENT)
public DocumentCollectionManager getManager() {
return entityManager.get(DATABASE);
}
}
What can I do to automatic inject Repositories in my Wildfly Swarm application?
The throwed error:
2018-05-23 11:30:31,270 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."demo.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."demo.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1978)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type UserRepository with qualifiers #Database
at injection point [BackedAnnotatedField] #Inject #Database private com.example.demo.rest.HelloWorldEndpoint.userRepository
at com.example.demo.rest.HelloWorldEndpoint.userRepository(HelloWorldEndpoint.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:362)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:284)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:137)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:158)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:501)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:61)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:59)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
2018-05-23 11:30:31,278 ERROR [org.jboss.as.controller.management-operation] (main) WFLYCTL0013: Operation ("add") failed - address: (("deployment" => "demo.war")) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"demo.war\".WeldStartService" => "Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type UserRepository with qualifiers #Database
at injection point [BackedAnnotatedField] #Inject #Database private com.example.demo.rest.HelloWorldEndpoint.userRepository
at com.example.demo.rest.HelloWorldEndpoint.userRepository(HelloWorldEndpoint.java:0)
"}}
2018-05-23 11:30:31,279 ERROR [org.jboss.as.server] (main) WFLYSRV0021: Deploy of deployment "demo.war" was rolled back with the following failure message:
{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"demo.war\".WeldStartService" => "Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type UserRepository with qualifiers #Database
at injection point [BackedAnnotatedField] #Inject #Database private com.example.demo.rest.HelloWorldEndpoint.userRepository
at com.example.demo.rest.HelloWorldEndpoint.userRepository(HelloWorldEndpoint.java:0)
"}}
how is going?
There're same bugs in your code:
The interface needs to be found by CDI, so I created a bean.xml to enable a full
scan in your code. On the MongoProducer you
don't need the: #Database(DatabaseType.DOCUMENT)
I created a PR:
https://github.com/vepo/wildly-swarm-jnosql/pull/1
Using WeldJUnit4Runner and getting error message:
Exception 0 : org.jboss.weld.exceptions.DeploymentException:
WELD-001443: Pseudo scoped bean has circular dependencies. Dependency
path:
- Managed Bean [class com.my.own.bounded_contexts.client.cache.cacheClientCommPriorizedAcceptRequestService]
with qualifiers [#Any #Default],
Any known solution for this problem in Weld?
More error message: java.lang.ExceptionInInitializerError
at com.my.own.WeldJUnit4Runner.createTest(WeldJUnit4Runner.java:18)
at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:244)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:241)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.jboss.weld.exceptions.DeploymentException: Exception
List with 102 exceptions: Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001443: Pseudo
scoped bean has circular dependencies. Dependency path:
- Managed Bean [class com.my.own.bounded_contexts.client.cache.cacheClientCommPriorizedAcceptRequestService]
with qualifiers [#Any #Default],
- [BackedAnnotatedField] #Inject private com.my.own.bounded_contexts.client.cache.cacheClientCommPriorizedAcceptRequestService.listener,
- Managed Bean [class com.my.own.bounded_contexts.client.cache.cacheClientCommPriorizedAcceptRequestListener]
with qualifiers [#Any #Default],
- [BackedAnnotatedField] #Inject private com.my.own.bounded_contexts.client.cache.cacheClientCommPriorizedAcceptRequestListener.clientCommPriorizedAcceptRequestRepository,
- Managed Bean [class com.my.own.bounded_contexts.client.repositories.ClientCommPriorizedAcceptRequestRepository]
with qualifiers [#Any #Default],
- [BackedAnnotatedField] #Inject #ClientCommPriorizedAcceptRequestCache private
com.my.own.bounded_contexts.client.repositories.ClientCommPriorizedAcceptRequestRepository.clientCallPriorizedAcceptRequestCache,
- Producer Method [RemoteCache] with qualifiers
[#ClientCommPriorizedAcceptRequestCache #Any] declared as
[[BackedAnnotatedMethod] #Produces
#ClientCommPriorizedAcceptRequestCache public
com.my.own.bounded_contexts.client.cache.cacheClientCommPriorizedAcceptRequestService.getClientCommPriorizedAcceptRequestRemoteCache()],
- Managed Bean [class com.my.own.bounded_contexts.client.cache.cacheClientCommPriorizedAcceptRequestService]
with qualifiers [#Any #Default]
at org.jboss.weld.bootstrap.Validator.reallyValidatePseudoScopedBean(Validator.java:897)
Weld complies with the specification in this respect.
From the CDI spec, section 5:
The container is required to support circularities in the bean
dependency graph where at least one bean participating in every
circular chain of dependencies has a normal scope, as defined in
Normal scopes and pseudo-scopes. The container is not required to
support circular chains of dependencies where every bean participating
in the chain has a pseudo-scope.
Try to get rid of the dependency cycle in your application, or at least give a normal scope to one of the beans involved.
I got a stupid problem when deploying my Java Application on JBoss. Before I changed my source code using an interface class everything was fine. So here is my problem:
public interface FWInterface {
public FWResult process(FWRequest fwRequest, FWResult fwResult,
Integer commitRows) throws Exception;
}
...
#Stateless
public class FWHandlerSqrMind extends FWHandlerDefault implements FWInterface {
public FWResult process(FWRequest fwRequest, FWResult fwResult, Integer commitRows)
throws Exception {
... some JavaCode here
}
}
This ends up with the following Error at deployment on JBoss 7.1:
10:05:34,838 ERROR [org.jboss.msc.service.fail] (MSC service thread
1-6) MSC00001: Failed to start service
jboss.deployment.unit."mdk-exchange-1.1.0.war".WeldService:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."mdk-exchange-1.1.0.war".WeldService:
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied
dependencies for type [FWHandlerAufTracking] with qualifiers
[#Default] at injection point [[field] #Inject
de.mdkbw.exchange.filewatcher.FWMain.fwhAufTracking] at
org.jboss.as.weld.services.WeldService.start(WeldService.java:83) at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA] at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[rt.jar:1.7.0_15] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[rt.jar:1.7.0_15] at java.lang.Thread.run(Unknown Source)
[rt.jar:1.7.0_15] Caused by:
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied
dependencies for type [FWHandlerAufTracking] with qualifiers
[#Default] at injection point [[field] #Inject
de.mdkbw.exchange.filewatcher.FWMain.fwhAufTracking] at
org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:311)
at
org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:280)
at
org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:143)
at
org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:163)
at
org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:382)
at
org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:367)
at
org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83) at
org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
If I remove the implementation everything is ok. Could anybody tell me what the problem is? Am I too stupid?? Thanks in advance!
How do you inject your bean? Like that?
#Inject
private FWHandlerSqrMind handler;
If so could you try to inject it like that:
#Inject
private FWInterface handler;
Do you have META-INF/beans.xml or WEB-INF/beans.xml file in your class path?
Missing beans.xml was the problem in my case (WildFly 8.2.0).
Just placing a simple beans.xml like the following solved this problem:
<?xml version="1.0"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd" />