[JAVA] [Liferay] Duplicate key value violates UNIQUE constraint for Resourcepermissionid in Liferay

Source: Internet
Author: User

Unexpected exception thrown when create new site:
09:47:10,114 ERROR [ajp-bio-8009-exec-113][JDBCExceptionReporter:82] Batch entry 0 insert into ResourcePermission (companyId, name, scope, primKey, roleId, ownerId, actionIds, resourcePermissionId) values ('10157', 'com.liferay.portlet.documentlibrary.model.DLFileEntry', '4', '24728', '10173', '0', '3', '11366') was aborted.  Call getNextException to see the cause.09:47:10,115 ERROR [ajp-bio-8009-exec-113][JDBCExceptionReporter:82] ERROR: duplicate key value violates unique constraint "resourcepermission_pkey"_  Detail: Key (resourcepermissionid)=(11366) already exists. [Sanitized]
Solution:

The doubling is caused by the Counter service (not sure what it actually does and assume it generates unique IDs for prim ary keys).

These changes is in the Tomcat\webapps\root\web-inf\classes\portal-ext.properties file

# # # # counter#### The Counter operates with are own data source to prevent deadlocks. by# default, the data source created for the counter uses the same settings as# those used to create the data source used For the rest of the portal.  that# happens by because the counter service would look up the properties# prefixed with "jdbc.default." To create its data Source. See the jdbc# properties prefixed with "Jdbc.default." For more information.## Setting a different value for the counter J DBC prefix allows better# fine tune the counter data source with its own set of configuration# settings for high AV Ailability installations. Note that these settings,# though separate, is a copy of the default settings with the newly# overridden values. #counter. jdbc.prefix=jdbc.counter.jdbc.counter.maxpoolsize=3jdbc.counter.minpoolsize=1jdbc.counter.numhelperthreads=1## Set the number of increments between database updates to the counter# table. Set this value to a higher number for better PerformancE. #counter. increment=100 

[Java][liferay] Duplicate key value violates UNIQUE constraint for Resourcepermissionid in Liferay

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.