Hi all,

Thought I'd forward this to the dev list as I really need some pointers here. We're using jackrabbit 1.6.4 and getting the exception below. Any thoughts on to why this might be occurring? I'm digging through the code right now but I have to admit the lock code is still a bit of a mystery to me at this point. :-)

Cheers,
Dan

---------- Forwarded message ----------
From: Dan Diephouse <dan.diephouse@mulesource.com>
Date: Wed, May 18, 2011 at 11:50 AM
Subject: SQLIntegrityConstraintViolationException
To: users <users@jackrabbit.apache.org>


We're having an issue writing to Jackrabbit. Check out the long exception below... We're just writing some data to a node, nothing special. I don't have enough of any idea about jackrabbit internals to know where to even start looking... Any ideas as to what could be going on or places to dig into more?
Dan

Repository access exception; nested exception is javax.jcr.RepositoryException: Error while creating lock.: failed to write property state: 6bd086d3-ccaf-47e1-83ca-1a0f6eb019bd/{http://www.jcp.org/jcr/1.0}lockOwner: failed to write property state: 6bd086d3-ccaf-47e1-83ca-1a0f6eb019bd/{http://www.jcp.org/jcr/1.0}lockOwnerorg.springmodules.jcr.JcrSystemException: Repository access exception; nested exception is javax.jcr.RepositoryException: Error while creating lock.: failed to write property state: 6bd086d3-ccaf-47e1-83ca-1a0f6eb019bd/{http://www.jcp.org/jcr/1.0}lockOwner: failed to write property state: 6bd086d3-ccaf-47e1-83ca-1a0f6eb019bd/{http://www.jcp.org/jcr/1.0}lockOwner 
at org.springmodules.jcr.SessionFactoryUtils.translateException(SessionFactoryUtils.java:233) 
at org.springmodules.jcr.JcrAccessor.convertJcrAccessException(JcrAccessor.java:58) 
at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:82) 
at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:108) 
at org.mule.galaxy.impl.jcr.onm.AbstractDao.executeLocked(AbstractDao.java:120) 
at org.mule.galaxy.impl.jcr.onm.AbstractDao.executeLockedAndDewrap(AbstractDao.java:95) 
at org.mule.galaxy.impl.jcr.onm.AbstractDao.save(AbstractDao.java:77) 
at org.mule.galaxy.impl.jcr.ActivityManagerImpl.logActivity(ActivityManagerImpl.java:207) 
at sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) 
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at $Proxy27.logActivity(Unknown Source) 
at com.mulesoft.tcat.impl.DeploymentServiceImpl.newDeploymentVersion(DeploymentServiceImpl.java:118) 
at sun.reflect.GeneratedMethodAccessor444.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) 
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at $Proxy73.newDeploymentVersion(Unknown Source) 
at com.mulesoft.tcat.rest.DeploymentsResource.newPackage(DeploymentsResource.java:124) 
at sun.reflect.GeneratedMethodAccessor939.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:172) 
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67) 
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:265) 
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83) 
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133) 
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71) 
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:996) 
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:947) 
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:938) 
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:399) 
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:478) 
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:663) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at com.mulesoft.common.remoting.RemoteContextSetupFilter.doFilter(RemoteContextSetupFilter.java:51) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.mule.galaxy.web.ThreadLocalCacheFilter.doFilter(ThreadLocalCacheFilter.java:27) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.mule.galaxy.web.ContextPathSaverFilter.doFilter(ContextPathSaverFilter.java:48) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.springmodules.jcr.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:93) 
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265) 
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) 
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.ui.switchuser.SwitchUserProcessingFilter.doFilter(SwitchUserProcessingFilter.java:341) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) 
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) 
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149) 
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
at com.mulesoft.tcat.monitoring.tomcat.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) 
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
at java.lang.Thread.run(Unknown Source) 
Caused by: javax.jcr.RepositoryException: Error while creating lock.: failed to write property state: 6bd086d3-ccaf-47e1-83ca-1a0f6eb019bd/{http://www.jcp.org/jcr/1.0}lockOwner: failed to write property state: 6bd086d3-ccaf-47e1-83ca-1a0f6eb019bd/{http://www.jcp.org/jcr/1.0}lockOwner 
at org.apache.jackrabbit.core.lock.LockManagerImpl.writeLockProperties(LockManagerImpl.java:860) 
at org.apache.jackrabbit.core.lock.XALockManager.lock(XALockManager.java:82) 
at org.apache.jackrabbit.core.lock.SessionLockManager.lock(SessionLockManager.java:160) 
at org.apache.jackrabbit.core.NodeImpl.lock(NodeImpl.java:4655) 
at org.apache.jackrabbit.util.Locked.tryLock(Locked.java:247) 
at org.apache.jackrabbit.util.Locked.with(Locked.java:143) 
at org.apache.jackrabbit.util.Locked.with(Locked.java:102) 
at org.mule.galaxy.impl.jcr.onm.AbstractDao$4.doInJcr(AbstractDao.java:126) 
at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:76) 
... 101 more 
Caused by: org.apache.jackrabbit.core.state.ItemStateException: failed to write property state: 6bd086d3-ccaf-47e1-83ca-1a0f6eb019bd/{http://www.jcp.org/jcr/1.0}lockOwner 
at org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:529) 
at org.apache.jackrabbit.core.persistence.AbstractPersistenceManager.store(AbstractPersistenceManager.java:75) 
at org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:315) 
at org.apache.jackrabbit.core.state.SharedItemStateManager$Update.end(SharedItemStateManager.java:749) 
at org.apache.jackrabbit.core.state.SharedItemStateManager.update(SharedItemStateManager.java:1503) 
at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:351) 
at org.apache.jackrabbit.core.state.XAItemStateManager.update(XAItemStateManager.java:354) 
at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:326) 
at org.apache.jackrabbit.core.lock.LockManagerImpl.writeLockProperties(LockManagerImpl.java:857) 
... 109 more 
Caused by: java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'JACKRABBIT_X0020_CORE_PROP_IDX' defined on 'JACKRABBIT_X0020_CORE_PROP'. 
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) 
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) 
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) 
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) 
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) 
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) 
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) 
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source) 
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source) 
at org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.executeStmt(DatabasePersistenceManager.java:900) 
at org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:522) 
... 117 more 
Caused by: java.sql.SQLException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'JACKRABBIT_X0020_CORE_PROP_IDX' defined on 'JACKRABBIT_X0020_CORE_PROP'. 
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) 
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) 
... 128 more 
Caused by: ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'JACKRABBIT_X0020_CORE_PROP_IDX' defined on 'JACKRABBIT_X0020_CORE_PROP'. 
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) 
at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(Unknown Source) 
at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(Unknown Source) 
at org.apache.derby.impl.sql.execute.IndexChanger.insert(Unknown Source) 
at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(Unknown Source) 
at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(Unknown Source) 
at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown Source) 
at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source) 
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) 
... 122 more 
Caused by:
javax.jcr.RepositoryException: Error while creating lock.: failed to write property state: 6bd086d3-ccaf-47e1-83ca-1a0f6eb019bd/{http://www.jcp.org/jcr/1.0}lockOwner: failed to write property state: 6bd086d3-ccaf-47e1-83ca-1a0f6eb019bd/{http://www.jcp.org/jcr/1.0}lockOwner 
at org.apache.jackrabbit.core.lock.LockManagerImpl.writeLockProperties(LockManagerImpl.java:860) 
at org.apache.jackrabbit.core.lock.XALockManager.lock(XALockManager.java:82) 
at org.apache.jackrabbit.core.lock.SessionLockManager.lock(SessionLockManager.java:160) 
at org.apache.jackrabbit.core.NodeImpl.lock(NodeImpl.java:4655) 
at org.apache.jackrabbit.util.Locked.tryLock(Locked.java:247) 
at org.apache.jackrabbit.util.Locked.with(Locked.java:143) 
at org.apache.jackrabbit.util.Locked.with(Locked.java:102) 
at org.mule.galaxy.impl.jcr.onm.AbstractDao$4.doInJcr(AbstractDao.java:126) 
at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:76) 
at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:108) 
at org.mule.galaxy.impl.jcr.onm.AbstractDao.executeLocked(AbstractDao.java:120) 
at org.mule.galaxy.impl.jcr.onm.AbstractDao.executeLockedAndDewrap(AbstractDao.java:95) 
at org.mule.galaxy.impl.jcr.onm.AbstractDao.save(AbstractDao.java:77) 
at org.mule.galaxy.impl.jcr.ActivityManagerImpl.logActivity(ActivityManagerImpl.java:207) 
at sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) 



--
Dan Diephouse
http://mulesoft.com | http://netzooid.com/blog