[Dspace-tech] Internal Server Error Creating Sub Community

4 views
Skip to first unread message

stuart.wood

unread,
Aug 26, 2015, 9:26:54 AM8/26/15
to dspac...@lists.sourceforge.net
Hi,

I am receiving the following internal server error when trying to create a
sub community - see below. I can still create top level communities and
collections - just not sub-communities.

Any ideas?

Thanks

Stuart

duplicate key value violates unique constraint "community2community_pkey"

database_error:org.postgresql.util.PSQLException\colon; ERROR\colon;
duplicate key value violates unique constraint "community2community_pkey"
org.postgresql.util.PSQLException: ERROR: duplicate key value violates
unique constraint "community2community_pkey"
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1531)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1313)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:258)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at
org.dspace.storage.rdbms.DatabaseManager.doInsertPostgres(DatabaseManager.java:1755)
at
org.dspace.storage.rdbms.DatabaseManager.insert(DatabaseManager.java:675)
at org.dspace.content.Community.addSubcommunity(Community.java:935)
at org.dspace.content.Community.create(Community.java:216)
at org.dspace.content.Community.createSubcommunity(Community.java:896)
at org.dspace.content.Community.createSubcommunity(Community.java:881)
at
org.dspace.app.webui.servlet.admin.EditCommunitiesServlet.processConfirmEditCommunity(EditCommunitiesServlet.java:489)
at
org.dspace.app.webui.servlet.admin.EditCommunitiesServlet.doDSPost(EditCommunitiesServlet.java:206)
at
org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:115)
at org.dspace.app.webui.servlet.DSpaceServlet.doPost(DSpaceServlet.java:73)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.dspace.app.webui.filter.RegisteredOnlyFilter.doFilter(RegisteredOnlyFilter.java:66)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.dspace.utils.servlet.DSpaceWebappServletFilter.doFilter(DSpaceWebappServletFilter.java:78)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:292)
at
org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:143)
at
org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:129)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)



--
View this message in context: http://dspace.2283337.n4.nabble.com/Internal-Server-Error-Creating-Sub-Community-tp4655256.html
Sent from the DSpace - Tech mailing list archive at Nabble.com.

stuart.wood

unread,
Aug 26, 2015, 9:26:57 AM8/26/15
to dspac...@lists.sourceforge.net
i can see the following info about the community2community table in
postgresql...

dspace=> \d community2community;
Table "public.community2community"
Column | Type | Modifiers
----------------+---------+-----------
id | integer | not null
parent_comm_id | integer |
child_comm_id | integer |
Indexes:
"community2community_pkey" PRIMARY KEY, btree (id)
"com2com_child_fk_idx" btree (child_comm_id)
"com2com_parent_fk_idx" btree (parent_comm_id)
Foreign-key constraints:
"com2com_child_fk" FOREIGN KEY (child_comm_id) REFERENCES
community(community_id) DEFERRABLE
"community2community_parent_comm_id_fkey" FOREIGN KEY (parent_comm_id)
REFERENCES community(community_id)

--
View this message in context: http://dspace.2283337.n4.nabble.com/Internal-Server-Error-Creating-Sub-Community-tp4655256p4655259.html

stuart.wood

unread,
Aug 26, 2015, 9:26:59 AM8/26/15
to dspac...@lists.sourceforge.net
may have fixed this myself. I recently migrated the database and somehow the
sequencing got out of sync on the community2community table, the following
looks to have fixed it...

SELECT setval('community2community_seq', (SELECT MAX(id) FROM
community2community)+1);



--
View this message in context: http://dspace.2283337.n4.nabble.com/Internal-Server-Error-Creating-Sub-Community-tp4655256p4655260.html

helix84

unread,
Aug 26, 2015, 9:27:00 AM8/26/15
to stuart.wood, dspac...@lists.sourceforge.net
On Fri, Jun 1, 2012 at 1:46 PM, stuart.wood <sw...@le.ac.uk> wrote:
> may have fixed this myself. I recently migrated the database and somehow the
> sequencing got out of sync on the community2community table, the following
> looks to have fixed it...
>
> SELECT setval('community2community_seq', (SELECT MAX(id) FROM
> community2community)+1);

Glad you figured it out. In the future, you may use the provided
script to update all sequences after such migrations:
[dspace]/etc/postgres/update-sequences.sql

In fact, you can run it even now in case some other sequences are wrong.

Regards,
~~helix84

stuart.wood

unread,
Aug 26, 2015, 9:27:01 AM8/26/15
to dspac...@lists.sourceforge.net
Reply all
Reply to author
Forward
0 new messages