Monday, February 24, 2020

Liferay 7.2/DXP Service Builder Behavior for Upgraded Database


When we upgrade portal from older version to newer version, we can see following issues when we deploy migrated service builder bundles. Specially from Liferay 6.1/6.2 to Liferay 7.2/DXP.

Liferay 6.1/6.2 Release_ tables will not add any records for service builder services until unless if write Upgrade Step Process. Liferay 7.2/DXP will behave very different and each and every service builder service must be register in Release_ tables then only service will be available in service registry.

Release_ Table



When we upgraded the database, all tables for service builder portlets are already existed and when we try to deploy migrated bundles in Liferay 7.2 we can see following issues.

The following service(s) are missing:
 * com.liferay.portal.kernel.configuration.Configuration (&(configuration.bundle.symbolic.name=com.foo.mytest.service)(name=service)) is not found in the service registry
 * com.liferay.portal.kernel.model.Release (&(release.bundle.symbolic.name=com.foo.mytest.service)(&(release.schema.version>=1.0.0)(!(release.schema.version>=1.1.0)))(|(!(release.state=*))(release.state=0))) is not found in the service registry

g! dm na
[950] com.foo.mytest.service
 [89] com.liferay.portal.spring.extender.internal.configuration.ServiceConfigurationInitializer unregistered
    com.liferay.portal.kernel.model.Release (&(release.bundle.symbolic.name=com.foo.mytest.service)(&(release.schema.version>=1.0.0)(!(release.schema.version>=1.1.0)))(|(!(release.state=*))(release.state=0))) service required unavailable
 [90] com.liferay.portal.spring.extender.internal.context.ModuleApplicationContextRegistrator unregistered
    com.liferay.portal.kernel.model.Release (&(release.bundle.symbolic.name=com.foo.mytest.service)(&(release.schema.version>=1.0.0)(!(release.schema.version>=1.1.0)))(|(!(release.state=*))(release.state=0))) service required unavailable
    com.liferay.portal.kernel.configuration.Configuration (&(configuration.bundle.symbolic.name=com.foo.mytest.service)(name=service)) service required unavailable
g!


Caused by: org.postgresql.util.PSQLException: ERROR: relation "foo_foo" already exists
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2412)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2125)

We can use following Gogo shell commands to know more about above issues.


ds:unsatisfied
scr:info <service-if>
inspect cap service <bundle-id>

dm wtf
dm na
dependencymanager:dm


Background of Issue

Liferay 7.2 Service builder portlet will use Release_ table to manage versions and each and every service must register in the table for first deployment (Service Builder Bundles). This will help to run Upgrade Step process in future to update/add database related activities for non-developer mode environments. For migrated database, tables already existed for each and every service builder so its assumed that bundle already deployed once and looking for Release_ table version  to proceed and register service.

We can categorize these things into two types of environments

Developer Environment

Example:

Local Development environment for developers schema changes will reflect automatically through schema.module.build.auto.upgrade is true and it will be run based on build number in the service.properties file.


Developer Environment Solution

We can resolve above two issues for Developer Environment with following options.

Option: 1

For local developments is very simple, delete service builder generated tables and delete record from Release_ table (If already exist) then redeploy service bundle then problem will be resolved.

Option: 2

This option will get rid of the manual deletion. We can use Liferay provided Maven or Gradle plugin called DB Support Plugin. Follow the reference links to know more about DB Support Plugin.

For Maven

Add DB Support plugin in the pom file and run db-support:clean-service-builder maven goal so that it will clean


For Gradle


Note:

Option: 1 and Option: 2 recommended for developer environment and your data will be lost in both cases. If you wanted avoid data lost follow the Non-Developer Environment solution.

Non-Developer Environment

Example: Production or Real Lower Level Environments DEV/SIT/UAT

For non-developer mode schema.module.build.auto.upgrade should be false and we have to write Upgrade Step Process component class to update database schema changes. We can also use DBA to execute schema changes related service builder.

Non-Developer Environment Solution

Step:1

Delete bundle from portal osgi\modules directory if already deployed.

Step:2

Add release record in Release_ table with default version 1.0.0 for your service.  ServeletContextName should your service bundle symbolic name.


Step:3

Update service bundle bnd.bnd Liferay-Require-SchemaVersion to default version that we already enter in the Release_ table record.


Step:4

Write dummy upgrade step in service. Follow the reference to create upgrade step with my notes.


You can skip “Writing upgrade steps and Waiting for upgrade completion” because we are trying to use the Dummy Upgrade Step that already as part of portal class loader.
Declaring dependencies need be corrected use com.liferay.portal.upgrade.api instead of com.liferay.portal.upgrade

Gradle:

Add following in the service build.gradle file


compile group: "com.liferay", name: "com.liferay.portal.upgrade.api", version: "2.0.0"

Maven:
Add following in the service pom.xml

<dependency>
            <groupId>com.liferay</groupId>
            <artifactId>com.liferay.portal.upgrade.api</artifactId>
            <version>2.0.0</version>
</dependency>

Upgrade Step Registration

package com.liferaysavvy.student.upgrade;

import com.liferay.portal.kernel.upgrade.DummyUpgradeStep;
import com.liferay.portal.upgrade.registry.UpgradeStepRegistrator;

import org.osgi.service.component.annotations.Component;

@Component(immediate = true, service = UpgradeStepRegistrator.class)
public class MyCustomModuleUpgrade implements UpgradeStepRegistrator {

    @Override
    public void register(Registry registry) {
        registry.register( "1.0.0", "1.0.1",new DummyUpgradeStep());

    }

}


Step:5

Restart Portal

Step:6

Build and deploy your service bundle. You can manually copy service jar to your OSGI module directory or use CI/CD to build and deploy service bundle to respective environments.

Step:7

You can verify the changes using above mentioned Gogo shell commands. Service should not be in the unsatisfied list. You can also notice your upgrade step process (upgrade:check).
If still see issue you can delete osgi cache and repeat same steps one more time.


We can notice new version is updated in Release_ table for deployed service and it will be created by Dummy Upgrade Step Process.

Note:
If you plan for production portal database upgrade. Identify all modules that you are migrating as Service builder bundles, write SQL script to add records in Release_ table with default version and keep this step as part of post upgrade process.


References:


Author

39 comments :

  1. You may be amazed by how many home owners forget about their kitchens whilst selling their residence.המלצות בעלי מקצוע

    ReplyDelete
  2. By the day's end, the arrangement was practically unavoidable, regardless of whether it had been Google, Apple or another organization inside the haze of combinations that could have purchased Github. visit website

    ReplyDelete
  3. Really, amazing content.

    ReplyDelete
  4. I think that thanks for the valuabe information and insights you have so provided here. שרת וירטואלי

    ReplyDelete
  5. Thanks for sharing the post.. parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family. Europa-Road traktor szállítás

    ReplyDelete
  6. Very good message. I stumbled across your blog and wanted to say that I really enjoyed reading your articles. Anyway, I will subscribe to your feed and hope you post again soon.

    Business Analytics Course in Bangalore

    ReplyDelete
  7. Actually I read it yesterday but I had some ideas about it and today I wanted to read it again because it is so well written.

    Data Analytics Course in Bangalore

    ReplyDelete
  8. You have a real ability for writing unique content. I like how you think and the way you represent your views in this article. I agree with your way of thinking. Thank you for sharing. pop corn time descargar

    ReplyDelete
  9. This article is an appealing wealth of informative data that is interesting and well-written. I commend your hard work on this and thank you for this information. You’ve got what it takes to get attention. زيادة متابعين انستقرام

    ReplyDelete
  10. I have to search sites with relevant information ,This is a
    wonderful blog,These type of blog keeps the users interest in
    the website, i am impressed. thank you.
    Data Science Training in Bangalore

    ReplyDelete
  11. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. website

    ReplyDelete
  12. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... website

    ReplyDelete
  13. Thankyou for this wondrous post, I am glad I observed this website on yahoo. xmeye for pc

    ReplyDelete
  14. The 2% of denver web design that do what you require will certainly do the adhering to, they will certainly spend for your domain, they will certainly develop you an internet site, they will certainly hold the internet site as well as they will certainly obtain the internet site positioned on the initial web page of Google all COST-FREE.

    ReplyDelete
  15. Hello my family member! I want to say that this post is awesome, nice written and include approximately all important infos. I would like to peer more posts like this. read the article

    ReplyDelete
  16. This is really a nice and informative, containing all information and also has a great impact on the new technology. Check it out here:Tables

    ReplyDelete
  17. i really like this article please keep it up. credit repair Michigan

    ReplyDelete
  18. I found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious... builder crm

    ReplyDelete
  19. Wonderful blog found to be very impressive to come across such an awesome blog. I should really appreciate the blogger for the efforts they have put in to develop such amazing content for all the curious readers who are very keen on being updated across every corner. Ultimately, this is an awesome experience for the readers. Anyways, thanks a lot and keep sharing the content in the future too.

    Digital Marketing Training in Bangalore

    ReplyDelete
  20. You have completed certain reliable points there. I did some research on the subject and found that almost everyone will agree with your blog.

    Data Science Training in Bangalore

    ReplyDelete
  21. The Extraordinary blog went amazed by the content that they have developed in a very descriptive manner. This type of content surely ensures the participants explore themselves. Hope you deliver the same near the future as well. Gratitude to the blogger for the efforts.

    Machine Learning Course in Bangalore

    ReplyDelete
  22. Nowadays people can easily complete a perfect website by the help of different plugins. And Quillforms is one of them this is the best typeform wordpress plugin for wordpress. With the help of this you can easily build different types of forms for your site.

    ReplyDelete
  23. I really got a lot of information from your site. I want to help you too.
    I hope you can visit my blog and get some good information like me.휴게텔

    ReplyDelete
  24. It will always be interesting to read content from
    other writers and practice something from their sites. 풀싸롱

    ReplyDelete
  25. I figured I would impart it to every one of you. woodland hills houses

    ReplyDelete
  26. Information storage space services are an extremely wise option for any type of firm, regardless of what phase it remains in. Whether you are simply starting, or well on your method right into increasing, there's an information storage NVMe-oF space remedies best for you. CAS is ideal for very controlled markets, regulation workplaces, as well as federal government firms.

    ReplyDelete
  27. It is late to find this act. At least one should be familiar with the fact that such events exist. I agree with your blog and will come back to inspect it further in the future, so keep your performance going.

    Digital Marketing Training in Bangalore

    ReplyDelete
  28. Happy to chat on your blog, I feel like I can't wait to read more reliable posts and think we all want to thank many blog posts to share with us.

    Machine Learning Course in Bangalore

    ReplyDelete
  29. There have also been some do-it-yourself business owners who feel they can optimize their own website as well. From an overall marketing standpoint, the case can be made that investing in online advertisement will potentially reach more prospective customers through SEO than other forms of advertising such as print ads. Whether you are contemplating optimization on your website or thinking about running your own SEO campaign, here are a few reasons why you should hire an SEO firm to help land you in front of more potential customers looking for your product or services. https://sites.google.com/view/seoservicesindelhiindia

    ReplyDelete
  30. I wanted to leave a little comment to support you and wish you the best of luck. We wish you the best of luck in all of your blogging endeavors.

    Digital Marketing Institute in Bangalore

    ReplyDelete
  31. SEO is the art to feed the SE spiders what they like; SEO software is running after the spiders trying to catch their attention. Before buying any SEO software, put its web site and web site examples to the test: can they say YES to 3 items: 1. Is the keywords' popularity high? 2. Is the keywords' competition high? 3. Is the keywords' ranking in the SE number 1? web hosting company

    ReplyDelete
  32. SEO (Search Engine Optimisation) is the process of getting traffic from organic search results on Search Engines. Google, Yahoo and other search engines show a set of primary search results to users and these results are ranked according to their relevancy through Search Engine Optimisation. This guide is to answer the basic questions which pop up in the mind of anyone new to this strategy. From generating traffic for your website, to keywords and the importance of using SEO services, we are going to help you sort out any and all confusion. There are certainly some of the best SEO companies, which are giving their customers the most reliable SEO services with the help of their SEO experts. https://hostinglelo.in/

    ReplyDelete
  33. The reason for IT is the catch, stockpiling, and recovery of business data to additional the association's center business destinations.placement cells database

    ReplyDelete
  34. It's superior, however , check out material at the street address. Roofing Companies In Calgary

    ReplyDelete
  35. https://www.visualaidscentre.com/service/eyes-specialist-delhi/ Online games are now much advanced with the introduction of flash games. These actually create zeal within the individual to play sport games, mystery games etc.

    ReplyDelete
  36. https://onohosting.com First of all what are game server providers, GSPs, and why do I need one? If, like me, you love playing games with your other online gaming buddies you generally play together online. You and your team need a playground that will provide the online space for you to. How and where does all that information get processed? There are three methods.

    ReplyDelete
  37. The last thing you need is to build a shed exclusively to need to destroy it due to some yank neighbor or in light of the fact that you are over a central pipe or electrical line that the service organization needs access as well.
    gazebo

    ReplyDelete

Recent Posts

Recent Posts Widget

Popular Posts