Liferay Portlet deployment error with build number

When multiple developers working on portlet that uses servicebuilder will give below exception “Build namespace has build number which is newer than “. When developer commits service.properties file and that deployed on other developer machine then it will throw below exception.

com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering plugins for leave-portlet at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46) at com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.invokeDeploy(PluginPackageHotDeployListener.java:64) at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:230) Caused by: com.liferay.portal.OldServiceComponentException: Build namespace js has build number 38 which is newer than 21 at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.initServiceComponent(ServiceComponentLocalServiceImpl.java:138) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115) at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)

Solution:

  1. create service-ext.properties file at the same locaiton of service.properties
  2. add build.number={higher-value or same value in exception)
  3. Deploy portlet again

Best Practice: To avoid these kind of errors, follow these

  1. Create service-ext.properties file with below properies and commit that file to SVN  and do the database tables creation manually. Restrict service-ext.properties file in SVN folder so that no body changes it only SVN admin can do
    build.number=1
    build.auto.upgrade=false
  2.  Please look into below tutorial about how to manage build number of liferay portlet in real time using Jenkins and SVN

Leave a Comment

Your email address will not be published. Required fields are marked *