I'm trying to upgrade spring from version 3.1 to version 4.0. But i am getting an error on RestApi :
14:11:00,286 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]
14:11:00,381 ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:413)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
Thanks in advance..
Related
I am trying to upgrade from spring boot 2.4.6 to 2.5.4 and have started receiving following error
Error starting ApplicationContext. To display the conditions report
re-run your application with 'debug' enabled. 2021-09-28 14:10:37
[main] ERROR o.s.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'supplierInitializer' defined in class path
resource
[org/springframework/cloud/stream/function/FunctionConfiguration.class]:
Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'inMemorySwaggerResourcesProvider_integrationflow.org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0':
Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'integrationGlobalProperties' defined in class
path resource
[org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.integration.context.IntegrationProperties]:
Factory method 'integrationGlobalProperties' threw exception; nested
exception is java.lang.IllegalAccessError: class
org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
tried to access private method 'void
org.springframework.integration.context.IntegrationProperties.()'
(org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
and org.springframework.integration.context.IntegrationProperties are
in unnamed module of loader 'app')
Not able to understand what has changed in spring boot 2.5.X , although upgrading till version 2.4.11 works fine.
I guess you have an old version of spring-integration-core library. Delete all the folders under .m2/repository/org/springframework/integration That should fix it.
Getting below issue while migration from 3.8.4 to 3.9.2 Mule runtime.
java.lang.NoClassDefFoundError: org/springframework/context/ResourceLoaderAware (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
I have spring spring-context-4.1.9.RELEASE.jar and all default jars in opt folder of Mule runtime.
ResourceLoaderAware class is in this spring-context-4.1.9.RELEASE.jar.
Any idea how do I resolve this issue.
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_muleTransactionManager': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.mule.api.transaction.TransactionManagerFactory org.mule.config.spring.factories.TransactionManagerFactoryBean.txManagerFactory; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] for bean with name 'entityManagerFactory' defined in class path resource [CCModuleFlood-context.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/ResourceLoaderAware (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:89) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:222) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:81) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:210) ~[mule-module-launcher-3.9.2.jar:3.9.2]
... 18 more
Error NoClassDefFoundError doesn't mean that it was not able to find the class, it means that there was some previous error loading the class. You need to find the previous error to identify the root cause.
It might that there are some incompatible versions in the classpath that caused the original error.
Currently we are migrating spring old version to 4.0.0. Also we o upgraded CAS 4.0.0.
Now we are getting
8 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /security/login: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Initialization of bean failed; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.LocalVariableTableParameterNameDiscoverer$ParameterNameDiscoveringVisitor has interface org.springframework.asm.ClassVisitor as super class
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) [spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) [spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) [spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE]
When I am trying to deploy the application on Websphere 7.0 I get the error message on console
0000000d SystemErr R SLF4J: This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version
Further when spring internally calling log4j api, following error occurs:
0000000d webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in ServletContext resource
[/WEB-INF/spring_config/jbpm_applicationContext.xml]: Instantiation of bean failed;
nested exception is org.springframework.beans.factory.BeanDefinitionStoreException:
Factory method [public org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is java.lang.NoSuchMethodError: org/apache/log4j/Logger.trace(Ljava/lang/Object;)V
I upgraded the log4j api from 1.2.16 to 1.2.17 but still i got the same error.
Additionally, slf4j-api-1.6.1.jar and slf4j-log4j12-1.6.1.jar are being used in classpath.
You should switch classloading policy for your application to "parent last". Then the version of log4j bundled with your application will be used. Please see Class loader settings for details.
I am getting the below error when I try to configure a spring-hibernate application:
org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from ServletContext resource
[/WEB-INF/spring-servlet.xml]; nested exception is
java.lang.NoSuchMethodError:
org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;
I have org.springframework.beans-3.0.0.M3.jar in the build path.
Please help.
Thanks in advance!
See java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add
Why you are using 3.0.0.M3 ?
Try to upgrade your spring version to 3.0.0.RELEASE.
add method was added in
Changes in version 3.0.0.RC3 (2009-12-01)
added chaining-capable "add" method to MutablePropertyValues