I've generated a webservice consumer with Jax-ws and packaged it into a jar-file using maven. I want to use this jar-file in a different project so that I can talk to the webservice from this other project. I added the dependency using maven and a local repository like this:
<dependencies>
<dependency>
<groupId>be.vrt</groupId>
<artifactId>ScheduAllClient</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>data-local</id>
<name>data</name>
<url>file://${project.basedir}/repo</url>
</repository>
</repositories>
When I run my project using spring boot in IntelliJ, I can talk to the WS without any problem. If I then package the project into a war-file and try to deploy on Wildfly, I get following error:
Cannot upload deployment: {
"WFLYCTL0080: Failed services" => {
"jboss.undertow.deployment.default-server.default-host./sa-integrations"
=> "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./sa-integrations:
java.lang.RuntimeException:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'KPSController': Unsatisfied dependency expressed through field 'kpsImportTask';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'KPSImportTask': Unsatisfied dependency expressed through field 'saService';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'SAService': Unsatisfied dependency expressed through field 'resourceDAO';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'resourceDAO': Unsatisfied dependency expressed through field 'scheduAllService';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduAllServiceImpl': Injection of resource dependencies failed;
nested exception is org.apache.cxf.wsdl11.WSDLRuntimeException: Part Body defined with no element and no type. Caused by: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'KPSController': Unsatisfied dependency expressed through field 'kpsImportTask';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'KPSImportTask': Unsatisfied dependency expressed through field 'saService';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'SAService': Unsatisfied dependency expressed through field 'resourceDAO';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'resourceDAO': Unsatisfied dependency expressed through field 'scheduAllService';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduAllServiceImpl': Injection of resource dependencies failed;
nested exception is org.apache.cxf.wsdl11.WSDLRuntimeException: Part Body defined with no element and no type.
Caused by:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'KPSController': Unsatisfied dependency expressed through field 'kpsImportTask';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'KPSImportTask': Unsatisfied dependency expressed through field 'saService';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'SAService': Unsatisfied dependency expressed through field 'resourceDAO';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'resourceDAO': Unsatisfied dependency expressed through field 'scheduAllService';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduAllServiceImpl': Injection of resource dependencies failed;
nested exception is org.apache.cxf.wsdl11.WSDLRuntimeException: Part Body defined with no element and no type.
Caused by:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'KPSImportTask': Unsatisfied dependency expressed through field 'saService';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'SAService': Unsatisfied dependency expressed through field 'resourceDAO';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'resourceDAO': Unsatisfied dependency expressed through field 'scheduAllService';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduAllServiceImpl': Injection of resource dependencies failed;
nested exception is org.apache.cxf.wsdl11.WSDLRuntimeException: Part Body defined with no element and no type.
Caused by:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'SAService': Unsatisfied dependency expressed through field 'resourceDAO';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'resourceDAO': Unsatisfied dependency expressed through field 'scheduAllService';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduAllServiceImpl': Injection of resource dependencies failed;
nested exception is org.apache.cxf.wsdl11.WSDLRuntimeException: Part Body defined with no element and no type.
Caused by:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'resourceDAO': Unsatisfied dependency expressed through field 'scheduAllService';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduAllServiceImpl': Injection of resource dependencies failed;
nested exception is org.apache.cxf.wsdl11.WSDLRuntimeException: Part Body defined with no element and no type.
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduAllServiceImpl': Injection of resource dependencies failed;
nested exception is org.apache.cxf.wsdl11.WSDLRuntimeException: Part Body defined with no element and no type.
Caused by:
org.apache.cxf.wsdl11.WSDLRuntimeException: Part Body defined with no element and no type."
},"WFLYCTL0412: Required services that are not installed:" => [
"jboss.undertow.deployment.default-server.default-host./sa-integrations"
],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}
The ScheduAllServiceImpl looks like this:
#Service
#Qualifier("ScheduAllService")
public class ScheduAllServiceImpl {
#WebServiceRef(SchedWebServiceAPI.class)
private SchedWebServiceAPISoap schedWebServiceAPISoap;
SchedWebServiceAPI.class is the main class of the required jar.
Does anybody know what is going wrong? I guess it has something to do with maven. I've tried packaging with mvn clean install or mvn clean package but nothing seems to work. When I check the war-file, the required jar file is present in WEB-INF/lib.
If it may be of any help, I'm using:
Maven 3.2.1
JDK 1.8
Wildfly 10.1.0
Related
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'm using Redis and created HttpSessionConfig file. Here is my code in
HttpSessionConfig.java:
#EnableRedisHttpSession
public class HttpSessionConfig {
#Bean
public LettuceConnectionFactory connectionFactory() {
return new LettuceConnectionFactory();
}
#Bean
public HttpSessionIdResolver httpSessionStrategy() {
return HeaderHttpSessionIdResolver.authenticationInfo();
}
}
And here is my pom.xml file:
<!-- Redis -->
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<dependency>
<groupId>biz.paluch.redis</groupId>
<artifactId>lettuce</artifactId>
<version>4.3.1.Final</version>
</dependency>
But I got error:
Error creating bean with name 'org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration':
Initialization of bean failed
More trace:
Caused by:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'sessionRepositoryFilterRegistration'
defined in class path resource
[org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.class]:
Unsatisfied dependency expressed through method
'sessionRepositoryFilterRegistration' parameter 1; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration':
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'connectionFactory' defined in class path
resource [bookstore/config/HttpSessionConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory]:
Factory method 'connectionFactory' threw exception; nested exception
is java.lang.NoClassDefFoundError: io/lettuce/core/KeyValue
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration':
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'connectionFactory' defined in class path
resource [bookstore/config/HttpSessionConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory]:
Factory method 'connectionFactory' threw exception; nested exception
is java.lang.NoClassDefFoundError: io/lettuce/core/KeyValue
Anyone know how to fix it ???
In the stack trace the error tells that
java.lang.NoClassDefFoundError: io/lettuce/core/KeyValue
So add manually the dependency io.lettuce in your pom.xml
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>5.1.7.RELEASE</version>
</dependency>
I have built thingsboard from sources, installed deb on ubuntu everything was running fine. For some reason I had to restart ubuntu, but after then i am getting following error on
sudo service thingsboard start
results in
ERROR 2127 --- [main] o.s.boot.SpringApplication : Application startup failed 2018-06-26 09:17:55.066 ERROR 3437 ---
[ost-startStop-1] o.s.b.c.embedded.tomcat.TomcatStarter : Error
starting Tomcat context. Exception:
org.springframework.beans.factory.UnsatisfiedDependencyException.
Message: Error creating bean with name
'thingsboardSecurityConfiguration': Unsatisfied dependency expressed
through field 'restAuthenticationProvider'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'restAuthenticationProvider' defined in
URL
[jar:file:/usr/share/thingsboard/bin/thingsboard.jar!/BOOT-INF/classes!/org/thingsboard/server/service/security/auth/rest/RestAuthenticationProvider.class]:
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'userServiceImpl': Unsatisfied
dependency expressed through field 'relationService'; nested exception
is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'baseRelationService': Unsatisfied
dependency expressed through field 'relationDao'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'jpaRelationDao': Unsatisfied dependency
expressed through field 'relationRepository'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'relationRepository': Cannot create inner bean
'(inner bean)#6d5d8247' 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)#6d5d8247': Cannot resolve
reference to bean 'entityManagerFactory' while setting constructor
argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in class path
resource
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]:
Invocation of init method failed; nested exception is
javax.persistence.PersistenceException: [PersistenceUnit: default]
Unable to build Hibernate SessionFactory 2018-06-26 09:17:55.199 ERROR
3437 --- [main] o.s.boot.SpringApplication :
Application startup failed
When I try to start the apache tomcat 7 via a command line I have this error:
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
... 95 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serverManagerImpl' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/org/hyperic/hq/appdef/server/session/ServerManagerImpl.class]: Unsatisfied dependency expressed through constructor argument with index 10 of type [org.hyperic.hq.appdef.shared.ServiceManager]: : Error creating bean with name 'serviceManagerImpl' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/org/hyperic/hq/appdef/server/session/ServiceManagerImpl.class]: Unsatisfied dependency expressed through constructor argument with index 11 of type [org.hyperic.hq.measurement.shared.MeasurementManager]: : Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serviceManagerImpl' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/org/hyperic/hq/appdef/server/session/ServiceManagerImpl.class]: Unsatisfied dependency expressed through constructor argument with index 11 of type [org.hyperic.hq.measurement.shared.MeasurementManager]: : Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
... 109 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serviceManagerImpl' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/org/hyperic/hq/appdef/server/session/ServiceManagerImpl.class]: Unsatisfied dependency expressed through constructor argument with index 11 of type [org.hyperic.hq.measurement.shared.MeasurementManager]: : Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
... 123 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
... 137 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)
... 149 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
... 162 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
... 184 more
12 mars 2014 15:02:50 org.apache.catalina.core.StandardContext startInternal
GRAVE: Error listenerStart
12 mars 2014 15:02:50 org.apache.catalina.core.StandardContext startInternal
GRAVE: Erreur de démarrage du contexte [] suite aux erreurs précédentes
12 mars 2014 15:02:50 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
GRAVE: The web application [] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
12 mars 2014 15:02:50 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
GRAVE: The web application [] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
12 mars 2014 15:02:50 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
GRAVE: The web application [] appears to have started a thread named [ZeventProcessor] but has failed to stop it. This is very likely to create a memory leak.
12 mars 2014 15:02:50 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Déploiement du répertoire /home/stage/apache-tomcat-7.0.52/webapps/docs de l'application web
12 mars 2014 15:02:50 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Déploiement du répertoire /home/stage/apache-tomcat-7.0.52/webapps/manager de l'application web
12 mars 2014 15:02:50 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Déploiement du répertoire /home/stage/apache-tomcat-7.0.52/webapps/host-manager de l'application web
12 mars 2014 15:02:50 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Déploiement du répertoire /home/stage/apache-tomcat-7.0.52/webapps/examples de l'application web
12 mars 2014 15:02:50 org.apache.catalina.startup.Catalina start
INFO: Server startup in 30733 ms
Can anyone help me please ?
i have a problem with a project that i want to run with maven, in with i use spring and hibernate, i'm new to these technokogies by the way. just if someone can hepl me solve the problem, on post me an example which cab be runned easly , thnas you
this is my exception :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
it's caused by :
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
....
thank you for help
java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
Seems like you are missing hibernate-core.jar in your project. Add it to your CLASSPATH. Pick version that is compatible with the rest of your stack.
Try adding this to pom.xml :
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.2.Final</version>
</dependency>
I can see couple of posts on the same issue. You can check below links and if that doesnt solve your problem then can put the configuration xml file you use to integrate spring with hibernate.
Exception NoClassDefFoundError for CacheProvider
java.lang.ClassNotFoundException: org.hibernate.cache.CacheProvider exception while integrating spring and hiberate