Error running app into jelastic

Hi, I could deploy the app, but when I open the browser, it is show this message:


PSQLException: ERROR: relation "country" does not exist
  Position: 13

com.haulmont.cuba.core.global.RemoteException:
---
org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.cuba12): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: relation "country" does not exist
  Position: 13
Error Code: 0
Call: INSERT INTO country (ID, name) VALUES (?, ?)
	bind => [1, Mexico]
Query: InsertObjectQuery(com.company.mundo.entity.Country-1 [new,managed])
---
javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.cuba12): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: relation "country" does not exist
  Position: 13
Error Code: 0
Call: INSERT INTO country (ID, name) VALUES (?, ?)
	bind => [1, Mexico]
Query: InsertObjectQuery(com.company.mundo.entity.Country-1 [new,managed])
---
org.eclipse.persistence.exceptions.DatabaseException: 
Internal Exception: org.postgresql.util.PSQLException: ERROR: relation "country" does not exist
  Position: 13
Error Code: 0
Call: INSERT INTO country (ID, name) VALUES (?, ?)
	bind => [1, Mexico]
Query: InsertObjectQuery(com.company.mundo.entity.Country-1 [detached])
---
org.postgresql.util.PSQLException: ERROR: relation "country" does not exist
  Position: 13
	at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:127)
	at sun.reflect.GeneratedMethodAccessor144.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
	at com.sun.proxy.$Proxy90.commit(Unknown Source)
	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 com.haulmont.cuba.core.sys.remoting.LocalServiceInvokerImpl.invoke(LocalServiceInvokerImpl.java:95)
	at com.haulmont.cuba.web.sys.remoting.LocalServiceProxy$LocalServiceInvocationHandler.invoke(LocalServiceProxy.java:146)
	at com.sun.proxy.$Proxy180.commit(Unknown Source)
	at com.haulmont.cuba.client.sys.DataManagerClientImpl.commit(DataManagerClientImpl.java:96)
	at com.haulmont.cuba.gui.data.impl.GenericDataSupplier.commit(GenericDataSupplier.java:90)
	at com.haulmont.cuba.gui.data.impl.DsContextImpl.commit(DsContextImpl.java:164)
	at com.haulmont.cuba.gui.components.EditorWindowDelegate.commit(EditorWindowDelegate.java:266)
	at com.haulmont.cuba.web.gui.WebWindow$Editor.commitAndClose(WebWindow.java:1578)
	at com.haulmont.cuba.gui.components.AbstractEditor.commitAndClose(AbstractEditor.java:109)
	at com.haulmont.cuba.gui.components.EditorWindowDelegate$2.actionPerform(EditorWindowDelegate.java:101)
	at com.haulmont.cuba.web.gui.components.WebButton.performAction(WebButton.java:44)
	at com.haulmont.cuba.web.gui.components.WebButton.lambda$new$61446b05$1(WebButton.java:36)

Thank you

Hi,

It seems that some of your Db-update scripts are missed. Could you find and share the script where the “country” table is created? DB-scripts are located in the modules/core/db/ folder. Note that every DBMS has its own set of scripts (they are put into folder with the corresponding name). Also look whether the script was put in the app.war which is deployed into Jelastic (you can find it in build/distibutions/war or download it from Cloud)

Hi, in modules\core\db\init\postgres there are these files 10.create-db.sql, 20.create-db.sql, 30.create-db.sql, but they are empty, also these other files in \modules\core\db\import\mundo only have
– Create a sequence for id column
create sequence seq_id_mundo_city increment by 100 start with 1 minvalue 0;

Thank you

Hi,

As far as I understand, you have generated a model from some Postgres DB.
And after that, you are trying to deploy the application to Jelastic. Right?

How have you connected the DB: as main or additional datastore?

When you generate a model from some DB you have two options:

  1. You can connect the database as main. In that case, Studio adds system tables to the database during the model generation. The application could work with the database, but the 10.create-db.sql is empty until you generate and save DB scripts.

  2. The database could be also connected as additional. In that case, the external DB schema could be left absolutely unmodified. System tables are created in the main database. For additional DB Studio generates import scripts only if needed, for instance, versioned interface added and the table has no “version” column. But user may refuse to apply them.
    As the database is additional, DB script for the entity will be never generated. It is feasible to host such application in Cloud if the external DB is accessible from there.

Regards.

Hi, I think I connected the DB as main because studio added system tables to the database during the model generation. I followed the tutorial Migrating a legacy application.

Thank you