I got the following error trace when deploying project to tomcat.
017-10-18 10:20:56.808 WARN [localhost-startStop-1] com.haulmont.cuba.core.sys.CubaCoreApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Cannot resolve reference to bean 'cubaDataSource_VehicleMaster' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cubaDataSource_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/VehicleMaster] is not bound in this Context. Unable to find [jdbc].
2017-10-18 10:20:56.816 ERROR [localhost-startStop-1] com.haulmont.cuba.core.sys.AbstractWebAppContextLoader - Error initializing application
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Cannot resolve reference to bean 'cubaDataSource_VehicleMaster' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cubaDataSource_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/VehicleMaster] is not bound in this Context. Unable to find [jdbc].
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cubaDataSource_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/VehicleMaster] is not bound in this Context. Unable to find [jdbc].
18-Oct-2017 10:20:56.834 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/heavy-core] startup failed due to previous errors
10:21:00,924 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.docx4j.utils.ResourceUtils] to ERROR
10:21:00,924 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.docx4j.Docx4jProperties] to ERROR
10:21:00,924 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [ org.xlsx4j.jaxb.Context] to ERROR
10:25:17,327 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.docx4j.utils.ResourceUtils] to ERROR
10:25:17,327 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.docx4j.Docx4jProperties] to ERROR
10:25:17,328 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [ org.xlsx4j.jaxb.Context] to ERROR
2017-10-18 10:25:22.875 WARN [localhost-startStop-1] com.haulmont.cuba.core.sys.CubaCoreApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Cannot resolve reference to bean 'cubaDataSource_VehicleMaster' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cubaDataSource_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/VehicleMaster] is not bound in this Context. Unable to find [jdbc].
2017-10-18 10:25:22.883 ERROR [localhost-startStop-1] com.haulmont.cuba.core.sys.AbstractWebAppContextLoader - Error initializing application
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Cannot resolve reference to bean 'cubaDataSource_VehicleMaster' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cubaDataSource_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/VehicleMaster] is not bound in this Context. Unable to find [jdbc].
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cubaDataSource_VehicleMaster' defined in class path resource [no/sws/heavytransport/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/VehicleMaster] is not bound in this Context. Unable to find [jdbc].
18-Oct-2017 10:25:22.897 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/heavy-core] startup failed due to previous errors
10:25:26,944 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.docx4j.utils.ResourceUtils] to ERROR
10:25:26,944 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.docx4j.Docx4jProperties] to ERROR
10:25:26,944 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [ org.xlsx4j.jaxb.Context] to ERROR
10:25:40,214 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.docx4j.utils.ResourceUtils] to ERROR
10:25:40,214 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.docx4j.Docx4jProperties] to ERROR
10:25:40,214 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [ org.xlsx4j.jaxb.Context] to ERROR
2017-10-18 10:35:27.725 ERROR [http-nio-8080-exec-7] com.haulmont.cuba.web.AppUI - Unable to init ui
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
The project consist of modules and one of the modules is using additional datasource.
When i ran the project in Cuba Studio everything worked as expected.
Here is the setup in the app.settings for main project
cuba.additionalStores = VehicleMaster
cuba.persistenceConfig_MasterVehicle = +no/sws/heavytransport/VehicleMaster-persistence.xml
cuba.dbmsType_MasterVehicle = postgres
cuba.dataSourceJndiName_MasterVehicle = jdbc/VehicleMaster