我想在ftp覆蓋文件時增加次要文檔版本。當我追蹤代碼時,ContentDiskDriver2.truncateFile()
用於覆蓋文件。在這個函數裏我使用versionService
來增加版本。下面的代碼是寫在truncateFile() 嘗試{Alfresco:在ftp覆蓋文件時增加文檔版本
NodeRef nodeRef = getNodeForPath(tree, DriverContent.FILE_OPEN_PARAMS.getPath());
System.out.println("Node Ref: " + nodeRef);
// Increase minor version to file.
Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(2, 1.0f);
versionProperties.put(Version.PROP_DESCRIPTION, "");
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR);
VersionService versionService = (VersionService) applicationContext.getBean("versionService");
versionService.createVersion(nodeRef, versionProperties);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
但不幸的是我得到這個錯誤。
2013-01-02 14:12:31,609 ERROR [org.alfresco.fileserver] [Sess_FTP3_192.168.1.166] Error from JLAN
org.alfresco.error.AlfrescoRuntimeException: 00020073 Transaction must be active and synchronization is required: Thread[Sess_FTP3_192.168.1.166,5,FTPSessions]
at org.alfresco.repo.transaction.AlfrescoTransactionSupport.registerSynchronizations(AlfrescoTransactionSupport.java:467)
at org.alfresco.repo.transaction.AlfrescoTransactionSupport.getSynchronization(AlfrescoTransactionSupport.java:451)
at org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource(AlfrescoTransactionSupport.java:244)
at org.alfresco.repo.transaction.TransactionalResourceHelper.incrementCount(TransactionalResourceHelper.java:71)
at org.alfresco.repo.policy.BehaviourFilterImpl.disableBehaviour(BehaviourFilterImpl.java:158)
at org.alfresco.repo.version.Version2ServiceImpl.createVersion(Version2ServiceImpl.java:212)
at org.alfresco.repo.version.Version2ServiceImpl.createVersion(Version2ServiceImpl.java:140)
at org.alfresco.filesys.repo.ContentDiskDriver2.increaseVersion(ContentDiskDriver2.java:2937)
at org.alfresco.filesys.repo.ContentDiskDriver2.truncateFile(ContentDiskDriver2.java:1652)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at $Proxy97.truncateFile(Unknown Source)
at org.alfresco.filesys.repo.NonTransactionalRuleContentDiskDriver.truncateFile(NonTransactionalRuleContentDiskDriver.java:480)
at org.alfresco.filesys.repo.LegacyFileStateDriver.truncateFile(LegacyFileStateDriver.java:471)
at org.alfresco.filesys.repo.BufferedContentDiskDriver.truncateFile(BufferedContentDiskDriver.java:532)
at org.alfresco.jlan.ftp.FTPSrvSession.procStoreFile(FTPSrvSession.java:2262)
at org.alfresco.jlan.ftp.FTPSrvSession.run(FTPSrvSession.java:4924)
at java.lang.Thread.run(Thread.java:662)
你能幫助我如何解決事務必須是活動和同步需要
我發現這個鏈接.. Is the Alfresco repository document version history available via CIFS/FTP?
感謝您的解釋......現在我可以根據您的解釋來解決....我找到了另一種替代解決方案。你能幫我檢查一下嗎? – swemon