Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-11286

Document update failed if JCRHook with Jackrabbit used

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 6.0.3 GA
    • Fix Version/s: 6.1.0 CE RC1
    • Component/s: DM
    • Labels:
      None
    • Environment:
      Jackrabbit 1.6.1

      Description

      Steps to reproduce:

      1) set dl.hook.impl to JCRHook in portal-ext.properties
      dl.hook.impl=com.liferay.documentlibrary.util.JCRHook

      2) add document into Document Library

      3) press Edit for that document

      4) upload it again and press Save

      Update of any document in Document Library failed, exceptions in log:

      06:37:10,964 ERROR [jsp:156] com.liferay.portal.kernel.exception.SystemException: javax.jcr.version.VersionException: No version with label '1.1' exists in this version history.
      at com.liferay.documentlibrary.util.JCRHook.deleteFile(JCRHook.java:396)
      at com.liferay.documentlibrary.util.HookProxyImpl.deleteFile(HookProxyImpl.java:113)
      at com.liferay.documentlibrary.util.SafeFileNameHookWrapper.deleteFile(SafeFileNameHookWrapper.java:168)
      at com.liferay.documentlibrary.service.impl.DLServiceImpl.deleteFile(DLServiceImpl.java:115)
      at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:67)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
      at com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.updateFileEntry(DLFileEntryLocalServiceImpl.java:1069)
      at com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.updateFileEntry(DLFileEntryLocalServiceImpl.java:764)
      at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:67)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
      at com.liferay.portlet.documentlibrary.service.impl.DLFileEntryServiceImpl.updateFileEntry(DLFileEntryServiceImpl.java:419)
      at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:67)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
      at com.liferay.portlet.documentlibrary.service.DLFileEntryServiceUtil.updateFileEntry(DLFileEntryServiceUtil.java:229)
      at com.liferay.portlet.documentlibrary.action.EditFileEntryAction.updateFileEntry(EditFileEntryAction.java:333)
      at com.liferay.portlet.documentlibrary.action.EditFileEntryAction.processAction(EditFileEntryAction.java:81)
      at com.liferay.portal.struts.PortletRequestProcessor.process(PortletRequestProcessor.java:170)
      Caused by: javax.jcr.version.VersionException: No version with label '1.1' exists in this version history.
      at org.apache.jackrabbit.core.version.VersionHistoryImpl.getVersionByLabel(VersionHistoryImpl.java:149)
      at com.liferay.documentlibrary.util.JCRHook.deleteFile(JCRHook.java:386)
      at com.liferay.documentlibrary.util.HookProxyImpl.deleteFile(HookProxyImpl.java:113)
      at com.liferay.documentlibrary.util.SafeFileNameHookWrapper.deleteFile(SafeFileNameHookWrapper.java:168)
      at com.liferay.documentlibrary.service.impl.DLServiceImpl.deleteFile(DLServiceImpl.java:115)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:67)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      at $Proxy158.deleteFile(Unknown Source)
      at com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.updateFileEntry(DLFileEntryLocalServiceImpl.java:1069)
      at com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.updateFileEntry(DLFileEntryLocalServiceImpl.java:764)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      ...

      Workaround:
      create your own Hook implementation:

      package some.your.package;

      import javax.jcr.version.VersionException;

      import com.liferay.documentlibrary.NoSuchFileException;
      import com.liferay.documentlibrary.util.JCRHook;
      import com.liferay.portal.kernel.exception.PortalException;
      import com.liferay.portal.kernel.exception.SystemException;

      public class OwnJCRHook extends JCRHook {

      @Override
      public void deleteFile(long companyId, String portletId, long repositoryId,
      String fileName, String versionNumber) throws PortalException,
      SystemException {
      try

      { super.deleteFile(companyId, portletId, repositoryId, fileName, versionNumber); }

      catch(SystemException se) {
      if (se.getCause() instanceof VersionException )

      { throw new NoSuchFileException(fileName, se.getCause()); }

      throw se;
      }
      }
      }

      put compiled class into Liferay (${liferay.home}/tomcat/webapps/ROOT/WEB-INF/classes in my environment)

      and correct portal-ext.properties:
      dl.hook.impl=some.your.package.OwnJCRHook

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  8 years, 23 weeks, 4 days ago

                  Packages

                  Version Package
                  6.1.0 CE RC1