Not clear how to deploy project to server

Could you please share some links or information on how to deploy project on server.
Ubuntu 16, Postgres, installed Tomcat.
I added task “task buildWar” from documentation, and created war files using “gradle buildWar”. Then I uploaded WAR files using Tomcat’s UI manager. “app” can start, but “app-core” can not start.
What is the right way to deploy project using command line? Ideally with minimal or no downtime. Finally I’d like to build and deploy via Jenkinsfile.

1 Like

Deployment of WAR files to Tomcat on Windows is covered here: On Linux it should be the same, just find out where to specify the JVM options: -Xmx512m -Dfile.encoding=UTF-8. In standalone Tomcat they are specified in bin/

As for redeployments, I recommend straightforward approach - stop Tomcat, copy new WARs, start Tomcat. It guarantees no memory leaks and has very little overhead because the most time is anyway spent on starting the app and not Tomcat itself.

Unfortunately this didn’t help.
Options were added to, tomcat was restarted.
But I still can start “app” but not “app-core”.

probably this may clarify something - /var/log/tomcat8/catalina.out has error:

2016-09-15 17:04:03.838 INFO [http-nio-8080-exec-7] com.haulmont.cuba.core.sys.AppContextL$
2016-09-15 17:04:04.093 INFO [http-nio-8080-exec-7] com.haulmont.cuba.core.sys.persistence$
2016-09-15 17:04:04.109 ERROR [http-nio-8080-exec-7] com.haulmont.cuba.core.sys.AppContextL$
java.lang.RuntimeException: ./app_home/app-core/work/persist$
at com.haulmont.cuba.core.sys.persistence.PersistenceConfigProcessor.create(Persist$
at com.haulmont.cuba.core.sys.AppContextLoader.beforeInitAppContext(AppContextLoade$
at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(Abstra$
at org.apache.catalina.core.StandardContext.listenerStart($
at org.apache.catalina.core.StandardContext.startInternal($
at org.apache.catalina.util.LifecycleBase.start( [tomcat8-ca$
at org.apache.catalina.manager.ManagerServlet.start( [tomc$
at org.apache.catalina.manager.HTMLManagerServlet.start($
at org.apache.catalina.manager.HTMLManagerServlet.doPost($
at javax.servlet.http.HttpServlet.service( [tomcat8-servlet-ap$
at javax.servlet.http.HttpServlet.service( [tomcat8-servlet-ap$
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt$
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.$
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.j$
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt$
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.$
at org.apache.tomcat.websocket.server.WsFilter.doFilter( [tomcat8-$
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt$
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.$
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEnco$
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt$
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.$
at org.apache.catalina.core.StandardWrapperValve.invoke($
at org.apache.catalina.core.StandardContextValve.invoke($
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.jav$

Caused by: ./app_home/app-core/work/persistence.xml (No such$
at Method) ~[na:1.8.0_91]
at ~[na:1.8.0_91]
at ~[na:1.8.0_91]
at ~[na:1.8.0_91]
at com.haulmont.cuba.core.sys.persistence.PersistenceConfigProcessor.create(Persist$
… 37 common frames omitted

Update: I manually foudn this missing file locally and copied it to the server to
and set appHome = '/var/lib/tomcat8/work’
but still get this error:
Caused by: /var/lib/tomcat8/work/app-core/work/persistence.x$
at Method) ~[na:1.8.0_91]

Empty project created from scratch has the same problem - so it is quite easy to reproduce.


did you see this thread: ?
How does your buildWar task definition look like?
Are you running java 8 on your ubuntu box?


For anyone having the problem where the persistence.xml is not found, you need to point appHome to where you installed Tomcat. For example, if you are using Ubuntu and you installed Tomcat in ‘/opt/tomcat’, you need to set appHome to ‘/opt/tomcat/webapps’.

If you are on Windows then you need to find the where tomcat is installed and copy the war files to that location. i.e. ‘c:/work/tomcat/webapps’ if you had installed tomcat in c:\work\tomcat’.

Once you have a valid appHome the CUBA framework will then create ‘${appHome}/app-core/work/persistence.xml’.

I think the documentation can be modified to just state that appHome should be an absolute path to the Tomcat webapps folder.


You are not quite correct. The appHome parameter of the buildGradle task defines a root folder where the application will create its working directories. So the only requirement is that the user from which the appserver is executed must have read-write access to this folder. If the folder doesn’t exist, it will be created (again, if appserver has enough rights).

I am not sure why I am not correct … I am saying the same thing just in different words. I struggled with this for hours and all I am saying is appHome should be an absolute path to the location you need the war files to end up in on the server you are deploying to. It’s not real clear to noobs what appHome should point to IMO.

Please note, I am not an expert in this area, I am trying to help others that are having the same problem I had. If I am getting things wrong then I will shut up.

Hello Konstantin,
I’m trying Cuba and I find it very handy so I’m developing a solution for one of my customers and I wanted to show them a test deploy on their cloud server (Ubuntu 16.04)
I’m experiencing the same problem more or less. I followed the instructions and I specified in (don’t know if it’s the right place) :

CATALINA_OPTS = “-Xmx512m -Dfile.encoding=UTF-8”

I changed appHome to :


I don’t get the persistence.xml error anymore, but I get these now:

Caused by: org.hsqldb.HsqlException: Connection refused (Connection refused)


org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [com.haulmont.cuba.core.jmx.PersistenceManager@3a13c201] with key ‘app-core.cuba:type=PersistenceManager’; nested exception is app-core.cuba:type=PersistenceManager

Is the first one related to the fact that I wanted to use the HSQLDB so I put a username and pwd in the tomcat context.xml?
Can you help me?
Thank you :slight_smile:

catalina.txt (256.3K)

Hi Lucio,

According to the log, the middleware block cannot connect to your database and doesn’t start properly, then webclient block cannot connect to the middleware.

Probably you are trying to use HSQL database with standalone connection. It works only when Studio serves your database in design time. You should either use another database like Postgres and setup it also in your test environment, see here, or use in-process HSQL in production by specifying an additional context.xml for production like this:


    <!-- Database connection -->

    <!-- Switch off session serialization -->
    <Manager pathname=""/>


You can configure your WAR task to use this file, see “Custom context.xml path” on Deployment Settings page in Studio.

Hello Konstantin,

I used posgres both locally and on the remote server and it worked!
thank you

Now I’m trying to migrate the local data to the cloud. I’m using:

psql -d -1 -f <backup_db.sql>

But I get many syntax errors…

What is the right procedure for this?