Foros de discusión

LR7 buildservice does not create table

Riccardo Berla, modificado hace 6 años.

LR7 buildservice does not create table

New Member Mensajes: 17 Fecha de incorporación: 16/06/16 Mensajes recientes
LR7 CE with tomcat an mysql.
1. I created a service with the servicebuilder template.
2. I adapted the service.xml within the service package.
3. I ran the buildService. All classes in the api- and in the service-package have been built successfully. However the table in the liferay db has not been created.

I searched for forum discussions with the similar problems. I followed those instructions and repeated the process from the very start several times. No chance. The table will not be created. Should I create that table myself?

Any suggestions are appreciated.

Kind regards
Riccardo
thumbnail
Olaf Kock, modificado hace 6 años.

RE: LR7 buildservice does not create table

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
Riccardo Berla:
1. I created a service with the servicebuilder template.
2. I adapted the service.xml within the service package.
3. I ran the buildService. All classes in the api- and in the service-package have been built successfully. However the table in the liferay db has not been created.


That's exactly the expected behaviour. Just building the plugin is not sufficient - the tables will be created once you deploy your plugin to a server. That's because your build environment is just one for compiling - technically you don't need a running Liferay instance for writing the code until you first want to run it - and at compile time it's undetermined which environment you want to run on.

Be careful though: Liferay's default behaviour changed between 6.2 and 7: If you modify the entity in service.xml, you'll have to write a manual upgrade routine: ServiceBuilder does no longer automatically perform the upgrade routines (reason: They were horribly inefficient, never meant for production. Sadly this led to the functionality going away completely)
Riccardo Berla, modificado hace 6 años.

RE: LR7 buildservice does not create table

New Member Mensajes: 17 Fecha de incorporación: 16/06/16 Mensajes recientes
Hi Olaf

Thanks for your response. I just forgot to mention that I made the blade delpoy also, without success.

Before deployment I added a dependency in build.gradle to my MVC-Portlet which uses the new service: compile project(":modules:currency-service:currency-service-api") then I saw that my MVC-Portlet received the service.xml file. It contains the line <service-builder auto-namespace-tables="false" package-path="biz.berla.myportal2.portlet.currency">. I asked myself if auto-namespace-tables=false prevents the creation of the table.

Never mind. I will try, as you recommended, a manual upgrade routine.

Thanks again.
Riccardo
thumbnail
David H Nebinger, modificado hace 6 años.

RE: LR7 buildservice does not create table

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Riccardo Berla:
Thanks for your response. I just forgot to mention that I made the blade delpoy also, without success.


I'm willing to bet your issue is that the module doesn't start, therefore it doesn't create the table.

Go to the gogo shell and list your beans; find your service module in the list and see if it is INSTALLED or ACTIVE. I'm guessing it will just be INSTALLED. If you try to start the bean, it will probably tell you that you have an unresolved reference that is preventing it from starting.







Come meet me at the 2017 LSNA!
Riccardo Berla, modificado hace 6 años.

RE: LR7 buildservice does not create table

New Member Mensajes: 17 Fecha de incorporación: 16/06/16 Mensajes recientes
Hello David

Thank for your input. Her is the excerpt of the modules list with all my modules:

...
  481|Active     |    1|myportal2.welcome.portlet (1.0.0)
  482|Active     |    1|reference.customers.portlet (1.0.0)
  483|Active     |    1|reference.projects.portlet (1.0.0)
  484|Active     |    1|reference.skills.portlet (1.0.0)
  493|Active     |    1|myportal2.portals.portlet (1.0.0)
  495|Active     |    1|myportal2.contact.form.portlet (1.0.0)
  505|Active     |    1|currency.rates.portlet (1.0.0)
  514|Active     |    1|currency.service (1.0.0)
  516|Active     |    1|currency.service-service (1.0.0)
  517|Active     |    1|currency.service-api (1.0.0)
  518|Active     |   10|myportal2-theme-id-theme (1.0.0)


All modules starting with currency are active. What intrigues me here - just a little - are the module names e.g. currency.service-api with a point in between. In my IDE they are named with a -sign like currency-service-api and that's the way I put the module name in the dependency of the currency-rates-portlet.

I think I will process an upgrade.

Thanks anyway
Riccardo
thumbnail
David H Nebinger, modificado hace 6 años.

RE: LR7 buildservice does not create table

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
The bundle names are based on the names in the bnd.bnd file and have nothing to do with IDE project names or folder names or ...

As Olaf said, after the initial deployment an update to service.xml will not result in a table and/or DDL change, it's up to you to build in the upgrade logic (although I do know there was an uproar raised about this, I'm not sure if in the end if the functionality was going to be restored or not).

I've got a blog about the update logic handling here: https://web.liferay.com/web/user.26526/blog/-/blogs/building-in-upgrade-support.
I also have one about how the automatic first update handles the application of the initial DDL:
https://web.liferay.com/web/user.26526/blog/-/blogs/servicebuilder-and-upgrade-processes.

There's also the official Liferay doco too: https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/creating-an-upgrade-process-for-your-app












Come meet me at the 2017 LSNA!
Riccardo Berla, modificado hace 6 años.

RE: LR7 buildservice does not create table

New Member Mensajes: 17 Fecha de incorporación: 16/06/16 Mensajes recientes
Wow, thanks David for the clarification concerning the module names.

I was just diving into the official Liferay 7 documentation. The other links you provided will certainly be helpful. I will dig me through and notify you as soon as I surface back up.

Kind regards
Riccardo
Riccardo Berla, modificado hace 6 años.

RE: LR7 buildservice does not create table

New Member Mensajes: 17 Fecha de incorporación: 16/06/16 Mensajes recientes
I am using the Liferay CE GA2 version liferay-ce-portal-tomcat-7.0-ga2-20160610113014153.

I am preparing an upgrade process to get my table initially created. In the Registrator part a com.liferay.portal.upgrade-2.7.1 module or a lower version of it is needed but missing. What is best to do now?

Sorry I am hanging. Normally I would just provide the jar file. But since I know that for creating a table I need an upgrade-process I doubt pasting a jar file is the right thing to do here.
thumbnail
David H Nebinger, modificado hace 6 años.

RE: LR7 buildservice does not create table

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Riccardo Berla:
In the Registrator part a com.liferay.portal.upgrade-2.7.1 module or a lower version of it is needed but missing. What is best to do now?


You have to see what version is provided by GA2. I think you can see that if you diag the bean. TripWire (in the marketplace) also lists all deployed versions. That's the version that you have to stick with.








Come meet me at the 2017 LSNA!
Riccardo Berla, modificado hace 6 años.

RE: LR7 buildservice does not create table

New Member Mensajes: 17 Fecha de incorporación: 16/06/16 Mensajes recientes
  • I upgraded Liferay CE from GA2 to GA4 7.0.3 build 7003
  • I ran the databe upgrade using java -jar com.liferay.portal.tools.db.upgrade.client.jar
  • I have Gradle version 3.1
  • com.liferay.gradle.plugins.workspace version 1.4.0


The ServiceBuilder still does not create my_currency table. It is not there after blade deploy. The release_ table has the entry 'currency.service-service' release 1.0.0. The servicecomponent table has no entry. On the currency-service and on the currency-api module I set my dependencies to compileOnly. Setting from 'compileOnly' to 'compile' did not bring me any further.

The currency.service-service-1.0.0.jar contains the entry 'Liferay-Spring-Context: META-INF/spring'.

Any idea what I could check or do next?

Kind regards, Riccardo