Got JdkVersion classNotFoundException - java

I have Updated spring version from 4.2.3 to 5.0.2 and security from 5.0.1 to 5.0.10 and using spring-flex version 1.6.0.RC1.
using BlazeDS Dependencies like this.
<!--=| BlazeDS Dependencies |=-->
<dependency org="com.adobe.blazeds" name="blazeds-core" rev="4.0.0.14931"/>
<dependency org="com.adobe.blazeds" name="blazeds-common" rev="4.0.0.14931"/>
<dependency org="com.adobe.blazeds" name="blazeds-remoting" rev="4.0.0.14931"/>
But i am getting following exception.
SEVERE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/JdkVersion
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)

the Flex Bean _messageBroker initialized failed.
It seems it only support spring 4.X and JdkVersion is deprecated in Spring 5.X

Related

Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#31' while setting bean property 'sourceList' with key

Recently, I have upgraded to Spring 5.3.20 from 4.0.5.RELEASE and I have changed the other dependencies versions also. It is getting successfully build, but when I try to run, it is giving error after jetty.
Upgraded versions in Pom.xml:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.8</java-version>
<org.springframework-version>5.3.20</org.springframework-version>
<org.springframework-security-version>5.6.3</org.springframework-security-version>
<org.apache.tiles-version>3.0.4</org.apache.tiles-version>
<!-- <org.hibernate-version>5.6.10.Final</org.hibernate-version> --> <!-- 4.3.5.Final -->
<org.hibernate-version>5.3.7.Final</org.hibernate-version><!-- 5.1.17.Final -->
<org.aspectj-version>1.6.10</org.aspectj-version>
<org.slf4j-version>1.7.7</org.slf4j-version>
<jackson.version>2.11.3</jackson.version> <!-- 2.11.3 -->
<!-- <jackson.version>2.14.1</jackson.version> -->
</properties>
The build is successful (using maven) but when I try to run the code I am getting this error after jetty,
Error -
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#31' while setting bean property 'sourceList' with key [31];
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#31': Cannot resolve reference to bean 'concurrencyFilter' while setting constructor argument with key [2];
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'concurrencyFilter' defined in ServletContext resource [/WEB-INF/spring/security.xml]: Instantiation of bean failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.web.session.ConcurrentSessionFilter]: No default constructor found;
nested exception is java.lang.NoSuchMethodException: org.springframework.security.web.session.ConcurrentSessionFilter.<init>()
Can anybody help me to resolve this error. Would really appreciate any help.

Spring boot spark application

I am using Spring Boot to implement a spark application. I build an uber jar, and use spark-submit to execute the application. But I got the following exception:
18/06/05 15:32:37 ERROR SpringApplication: Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gsonBuilder' defined in class path resource
[org/springframework/boot/autoconfigure/gson/GsonAutoConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [com.google.gson.GsonBuilder]: Factory method
'gsonBuilder' threw exception; nested exception is
java.lang.BootstrapMethod
Error: java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder;
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1254)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103)
.....
The exception is still there even if I put the following dependency in my pom.xml:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>compile</scope>
</dependency>
How can I resolve this dependency issue?
Maybe you can use #SpringBootApplication(exclude = {GsonAutoConfiguration.class}) to disable gson autoconfiguration.

com.fasterxml.jackson.databind.JavaType.isTypeOrSubTypeOf(Ljava/lang/Class;)Z\ expicitly on Jboss EAP 7

I am relatively new to spring ,I am facing jackson data bind error while deploying the war to Jboss EAP 7 but when i deploy the same war on wildfly 10 its deploying successfully .I have added Moxy but its not helping on Jboss
Jboss Log
"{\"WFLYCTL0080: Failed services\" => {\"jboss.undertow.deployment.default-server.default-host.\\"/gamification-1.0.0\\"\" => \"org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host.\\"/gamification-1.0.0\\": java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isTypeOrSubTypeOf(Ljava/lang/Class;)Z
Caused by: java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isTypeOrSubTypeOf(Ljava/lang/Class;)Z
Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isTypeOrSubTypeOf(Ljava/lang/Class;)Z
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isTypeOrSubTypeOf(Ljava/lang/Class;)Z
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isTypeOrSubTypeOf(Ljava/lang/Class;)Z\"}}"
I know It has passed many days just Answering if someone else got the problem.
What i did was just Excluded Rest Easy Implementation from Jboss by Adding the Following Config File ,So it wont clash with Jersey config
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
</exclusions>
</deployment>
</jboss-deployment-structure>
After including that Issue Was resolved

NoClassDefFoundError: org/springframework/aop/framework/AbstractAdvisingBeanPostProcessor

I understand similar question has been asked before but I've tried all those solutions but nothing has worked for me.
I'm getting the following error. I've added spring-aop and excluded it from jersey-spring
All the code is on GITHUB:
https://github.com/yogi-oc/OC-Latest-Spring
Using Java 8 and Tomcat 8
Any help is greatly appreciated.
Thanks
Jun 23, 2016 10:24:55 AM org.apache.catalina.core.ApplicationContext log
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [5]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'ldapAuthenticationProvider' while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ldapAuthenticationProvider' defined in class path resource [org/akaza/openclinica/applicationContext-core-security.xml]: Cannot create inner bean 'org.springframework.security.ldap.authentication.BindAuthenticator#2f6a096c' of type [org.springframework.security.ldap.authentication.BindAuthenticator] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.ldap.authentication.BindAuthenticator#2f6a096c' defined in class path resource [org/akaza/openclinica/applicationContext-core-security.xml]: Cannot resolve reference to bean 'openClinicaLdapUserSearch' while setting bean property 'userSearch'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openClinicaLdapUserSearch': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.akaza.openclinica.service.user.LdapUserService org.akaza.openclinica.service.user.OpenClinicaLdapUserSearch.ldapUserService; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor] for bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in null: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/framework/AbstractAdvisingBeanPostProcessor
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:336)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:359)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:157)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1471)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1216)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.akaza.openclinica.dao.core.OCContextLoaderListener.contextInitialized(OCContextLoaderListener.java:38)
Use this code
<security:http auto-config="true" use-expressions="true">
And another thing
Bean creation error for "org.springframework.security.filterChains" comes when you are using spring version higher than 3.1 and have not added dependencies manually for spring-aop, spring-jdbc, spring-tx and spring-expressions in you POM.xml.
Reason : If don't do so, maven automatically downloads older version jars (3.0.x) for these artifacts which conflict with newer version spring security jars.
Credit goes to #aayushdriger
When I looked in the web/target folder, under the exploded war there were no jars. I removed the entire folder and reran Tomcat within intelliJ and this time around it did explode the war with all the jars. The application is running successfully.

Spring MVC - can't find referenced pointcut webLayer

Having an issue deploying a Spring 3.0.7 MVC web application to Tomcat via Eclipse and the WST plugin. Getting this error message:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'messageSource' defined in ServletContext
resource [/WEB-INF/beans/appContext.xml]: BeanPostProcessor before
instantiation of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.transaction.config.internalTransactionAdvisor':
Cannot resolve reference to bean
'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0'
while setting bean property 'transactionAttributeSource'; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0':
Initialization of bean failed; nested exception is
java.lang.IllegalArgumentException: error at ::0 can't find referenced
pointcut webLayer
Any ideas? Thanks.
Got past this issue for now. Was using the wrong version of JDK for our project (1.7 instead of 1.6).
You can try updating the pom to use aspectjrt-1.7 / aspectjweaver-1.7 for 1.7 java.
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.7.4</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.7.4</version>
</dependency>

Categories

Resources