NoSuchBeanDefinitionException: No bean named 'cuba_ClientCacheManager and cuba_DbUpdater' is define

Hello there,

I’m running CUBA platform 6.3.5 and get the following two exceptions upon deploying to a remote web server (Tomcat 8.0.35).

 ==> localhost.2017-01-17.log <==
17-Jan-2017 10:23:01.967 INFO [localhost-startStop-4] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
17-Jan-2017 10:23:01.969 INFO [localhost-startStop-4] org.apache.catalina.core.ApplicationContext.log Initializing AtmosphereFramework
17-Jan-2017 10:23:02.579 SEVERE [localhost-startStop-4] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class com.haulmont.cuba.core.sys.singleapp.SingleAppCoreServletListener
 java.lang.RuntimeException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cuba_DbUpdater' is defined
	at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:78)
	at com.haulmont.cuba.core.sys.singleapp.SingleAppCoreContextLoader.contextInitialized(SingleAppCoreContextLoader.java:56)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216)
	at com.haulmont.cuba.core.sys.singleapp.SingleAppCoreServletListener.contextInitialized(SingleAppCoreServletListener.java:88)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4813)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5272)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940)
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1816)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cuba_DbUpdater' is defined
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:701)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1180)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076)
	at com.haulmont.cuba.core.sys.AppContextLoader.afterInitAppContext(AppContextLoader.java:105)
	at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:72)
	... 20 more

17-Jan-2017 10:23:02.654 SEVERE [localhost-startStop-4] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class com.haulmont.cuba.web.sys.singleapp.SingleAppWebServletListener
 java.lang.RuntimeException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cuba_ClientCacheManager' is defined
	at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:78)
	at com.haulmont.cuba.web.sys.singleapp.SingleAppWebContextLoader.contextInitialized(SingleAppWebContextLoader.java:61)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216)
	at com.haulmont.cuba.web.sys.singleapp.SingleAppWebServletListener.contextInitialized(SingleAppWebServletListener.java:84)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4813)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5272)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940)
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1816)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cuba_ClientCacheManager' is defined
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:701)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1180)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1082)
	at com.haulmont.cuba.core.global.AppBeans.get(AppBeans.java:61)
	at com.haulmont.cuba.web.sys.WebAppContextLoader.afterInitAppContext(WebAppContextLoader.java:47)
	at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:72)
	... 20 more


==> catalina.2017-01-17.log <==
17-Jan-2017 10:23:02.655 SEVERE [localhost-startStop-4] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
17-Jan-2017 10:23:02.656 SEVERE [localhost-startStop-4] org.apache.catalina.core.StandardContext.startInternal Context [/app] startup failed due to previous errors
17-Jan-2017 10:23:02.665 INFO [localhost-startStop-4] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /projects/MyApp/.../apache-tomcat-8.0.35/webapps/app.war has finished in 5,416 msI created the single war with following task:

 task buildRemoteWar(type: CubaWarBuilding, dependsOn: prepareSpringLocalConfig) {
    appHome = './work'
    appProperties = ['cuba.automaticDatabaseUpdate': 'true',
                     'cuba.web.loginDialogDefaultUser': '<disabled>',
                     'cuba.web.loginDialogDefaultPassword': '<disabled>']
    includeJdbcDriver = true
    includeContextXml = false
    singleWar = true
    webXml = "${webModule.projectDir}/web/WEB-INF/single-war-web.xml"

Seems like the server expects some application properties from the cuba framework but can’t find them.
I tried setting the property includeContextXml to true, but that didn’t help.
Any guidance is much appreciated.

Hi Max,

It seems like Spring container is not initialized properly. Please share the full app.log since the server start - we’ll try find out the reason.

Hello,

it seems like the server doesn’t log to app.log.
The integrated tomcat server for fast deployment does, tho.
I can only find catalina.out and localhost.log, that one is attached below.

localhost.2017-01-18.log (6.3K)

So as it looks like, it was the fault of the single web war building.
With the example file from the 6.3 docs I was able to deploy the application now successfully.
I’ll append both versions below for comparison (single-web-war.xml does NOT work, single-web-war2.xml DOES work). Than you for your time.

single-war-web.xml (2.7K)

single-war-web2.xml (1.9K)

Thank you for the research and for reporting the solution. We’ll check what can be wrong with the web.xml generation ASAP.

HI,

Could you please describe how you have created the single-war-web.xml file(which does NOT work)? The exception occurs due to the appComponents param is missed in it.


<context-param>
        <param-name>appComponents</param-name>
        <param-value>com.haulmont.cuba</param-value>
    </context-param>

Hi,

Thank you for reporting the problem.

The wrong single-war-web.xml (similar to yours) could be generated during project migration from the platfrom 6.2 to 6.3. We have created a YouTrack issue, the link is on the right.

To solve the problem you can regenerate the single-war-web.xml using Studio: open “Deployment settings”, switch to the WAR tab and press the “Generate” button near “Custom web.xml path”.

Thanks again for the quick and awesome help!

I did indeed upgrade from 6.2.x to 6.3.x few weeks ago…

When I generate the single-web-war from within the Deployment settings, all is working fine.

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/STUDIO-3299