Unable to Find JDBC After Cloud Deployment

I am using Studio to deploy to cloud (Jelastic - LayerShift). Trying to load the deployed project results in an error:

Caused by: javax.naming.NameNotFoundException: Name [jdbc/<<DATABASE>>] is not bound in this Context. Unable to find [jdbc].

I have the checkboxes for “Include JDBC driver” and “Include context.xml” checked and the custom content.xml path has been generated by Studio.

I have included the log file (catalina.out) in which the error is found.

layershift-catalina.out.txt (45.4K)

Do you use additional datastores in your application?
I am afraid, additional datastores are not supported in Cloud without manual setup.
Check the modules/core/web/META-INF/jelastic-context.xml config file. There is no section with name=jdbc/<>. Right? Try to copy it from context.xml, and redeploy the application. Note that all the datastores should be accessible from your Jelastic environment.

See also the following topic: Deployment with multiple data stores - CUBA.Platform

Yes, I am using additional datastores.

I copied those sections in content.xml over to jelastic-context.xml. It includes the same error, along with one that says The main resource set specified [/opt/tomcat/webapps/context] is not valid.

I was under the impression that additional datastores would be deployed along with the project - I had them on localhost the same way as the main database. I had hoped to keep the structure the same as the old application, so I left them separated.
From what you are saying, additional datastores are assumed to be accessible over a URL? In that case, I suppose the solution would be for me to combine the databases together. This might solve the above error, as well.

Thank you. I will combine the databases into main so as to avoid additional datastores and report back.

You can move entities from additional datastore to main using Studio: change value of the “Data store” field. Studio will generate create-scritps for required tables.

1 Like

I have successfully moved the tables from the additional datastores into the main database. I didn’t know about that method of moving them, so I did it the hard way (created a new project, copied the work over, moved the tables themselves, and generated the model fresh). Thanks for the suggestion! I will keep that in mind.

From all appearances, everything is up and running well. I discovered and overcame a few obstacles along the way, such as adding an SSL certificate because that’s required for service workers, and making sure the deployed context is the same as my module prefix (“app”), but it is functioning now.

Thanks very much!

I noticed that my table data (the rows) did not get copied over. Is it right to assume that this will have to be done manually?

You can init the production DB with data using the 30.create-db.sql script.
It will be executed during the first application start if the database has not been initiated yet and automatic database update is enabled.
It is also allowed to fill data using update scripts.
Note that the scripts should be put to the folder which corresponds to your DBMS type (modules/core/db/init/postgres and modules/core/db/update/postgres for Postgres).
I have also described the database update here.
Regarding additional datastores in Cloud, I have created a Youtrack issue and probably we will support it in future. Thank you.

1 Like

Good to know!

Thank you very much for your assistance. I appreciate your help a lot.