We are migrating an application from JBoss EAP 6.4 to JBoss EAP 7.3.
Since compatible spring version for JBoss 7.3 is 5.2.4.RELEASE, we are migrating spring framework from 4.2.4.RELEASE to 5.2.4.RELEASE.
While migrating we are getting different exceptions like below.
NoSuchBeanDefinitionException, BeanCreationException, .IllegalArgumentException: 'Could not find config file (input) named: xxx.properties' cannot be null. Please find below details.
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xx' available
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_271]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_271]
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_271]
at org.jboss.threads.JBossThread.run(JBossThread.java:485) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xx' defined in class path resource [config/spring/xx.xml]: Cannot resolve reference to bean 'xx' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xx' available
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:254) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
... 8 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xx' defined in class path resource [config/spring/xx.xml]: Cannot resolve reference to bean 'xx' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xx' available
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:705)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1358)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:217) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:186) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
... 10 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xx' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:805)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1279)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330)
... 38 more
Constructor threw exception; nested exception is java.lang.IllegalArgumentException: 'Could not find config file (input) named: xx.properties' cannot be null
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_271]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_271]
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_271]
at org.jboss.threads.JBossThread.run(JBossThread.java:485) [jboss-threads-2.3.3.Final-redhat-00001.jar:2.3.3.Final-redhat-00001]
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xx' defined in class path resource [config/spring/xx.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [xx]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: 'Could not find config file (input) named: xx.properties' cannot be null
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:254) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
... 8 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xx' defined in class path resource [config/spring/xx.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [xx]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: 'Could not find config file (input) named:xx.properties' cannot be null
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1320)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:217) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:186) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504) [wildfly-undertow-7.3.0.GA-redhat-00004.jar:7.3.0.GA-redhat-00004]
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
... 10 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [xx]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: 'Could not find config file (input) named: xx.properties' cannot be null
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:216)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1312)
... 34 more
Caused by: java.lang.IllegalArgumentException: 'Could not find config file (input) named: xx.properties' cannot be null
.
.
.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.8.0_271]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [rt.jar:1.8.0_271]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.8.0_271]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [rt.jar:1.8.0_271]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:203)
... 36 more
Comment From: sbrannen
I've edited your comment to improve the formatting. You might want to check out this Mastering Markdown guide for future reference.
Comment From: AshwiniAJadhav
Thanks sbrannen :)
Comment From: sbrannen
Can you please provide the contents of config/spring/xx.xml
?
If not, is it possible for you to provide a scaled down version of your application (or a similar demo application) that reproduces the exceptions you are encountering?
Comment From: AshwiniAJadhav
Below are the contents of config/spring/xx.xml
<bean id="aa" class="xxHandler">
<constructor-arg ref="xx" />
<constructor-arg>
<bean class="bbImpl" factory-method="getInstance" scope="prototype">
<constructor-arg ref="a"/>
</bean>
</constructor-arg>
<constructor-arg ref="b" />
<constructor-arg ref="c" />
</bean>
We are getting bean creation exception for this "xx" bean.
Comment From: sbrannen
It looks like the constructor for your xx
bean fails because it cannot find a properties file:
'Could not find config file (input) named: xx.properties' cannot be null
Are you sure the xx.properties
file is accessible by the constructor for xx
?
What does the XML bean definition for the xx
bean look like?
Comment From: AshwiniAJadhav
Below is the XML bean definition for the xx
bean.
<context:property-placeholder location="classpath:/aa.properties, classpath:/xx.properties"/>
<context:component-scan base-package="abc"/>
<import resource="classpath:/config/spring/applicationContext.xml"/>
<import resource="classpath:/config/spring/applicationContext-legacy.xml"/>
<bean id="xx" class="PropertiesFileImpl" />
Comment From: sbrannen
Thanks for providing the XML snippet for the xx
bean. Without seeing the code, it appears that the constructor for your PropertiesFileImpl
attempts to load the xx.properties
properties file but fails to do so.
Thus, it may be that you have changed the location of that properties file while upgrading.
In any case, it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.