Liferay 6.2 LAR import: No JournalFolder exists with the primary key 2

懵懂的女人 提交于 2019-12-13 09:40:04

问题


I'm trying to import a LAR file containing portlets, JournalFolders and JournalArticles from the Sites page with Import.

However I get the following exception:

com.liferay.portal.kernel.lar.PortletDataException: com.liferay.portlet.journal.NoSuchFolderException: No JournalFolder exists with the primary key 2
     at com.liferay.portal.kernel.lar.BaseStagedModelDataHandler.importStagedModel(BaseStagedModelDataHandler.java:168)
     at com.liferay.portal.kernel.lar.StagedModelDataHandlerUtil.importStagedModel(StagedModelDataHandlerUtil.java:317)
     at com.liferay.portal.kernel.lar.StagedModelDataHandlerUtil.importReferenceStagedModels(StagedModelDataHandlerUtil.java:278)
     at com.liferay.portlet.journal.lar.JournalContentPortletDataHandler.doProcessImportPortletPreferences(JournalContentPortletDataHandler.java:214)
     at com.liferay.portal.kernel.lar.BasePortletDataHandler.processImportPortletPreferences(BasePortletDataHandler.java:535)
     at com.liferay.portal.lar.PortletImporter.importPortletPreferences(PortletImporter.java:1159)
     at com.liferay.portal.lar.LayoutImporter.doImportLayouts(LayoutImporter.java:599)
     at com.liferay.portal.lar.LayoutImporter.importLayouts(LayoutImporter.java:118)
     at com.liferay.portal.service.impl.LayoutLocalServiceImpl.importLayouts(LayoutLocalServiceImpl.java:1756)
     at com.liferay.portal.service.impl.LayoutLocalServiceImpl.importLayouts(LayoutLocalServiceImpl.java:1805)
     at sun.reflect.GeneratedMethodAccessor1996.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
     at com.liferay.portal.service.impl.LayoutLocalServiceVirtualLayoutsAdvice.invoke(LayoutLocalServiceVirtualLayoutsAdvice.java:180)
     at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
     at com.liferay.portal.service.impl.LayoutLocalServiceStagingAdvice.invoke(LayoutLocalServiceStagingAdvice.java:141)
     at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
     at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
     at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
     at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
     at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
     at com.sun.proxy.$Proxy50.importLayouts(Unknown Source)
     at com.liferay.portal.service.LayoutLocalServiceUtil.importLayouts(LayoutLocalServiceUtil.java:1308)
     at com.liferay.portal.lar.backgroundtask.LayoutImportBackgroundTaskExecutor.execute(LayoutImportBackgroundTaskExecutor.java:61)
     at com.liferay.portal.kernel.backgroundtask.SerialBackgroundTaskExecutor.execute(SerialBackgroundTaskExecutor.java:56)
     at com.liferay.portal.backgroundtask.messaging.BackgroundTaskMessageListener.doReceive(BackgroundTaskMessageListener.java:108)
     at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
     at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:72)
     at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:69)
     at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:682)
     at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:593)
     at java.lang.Thread.run(Thread.java:744)
Caused by: com.liferay.portlet.journal.NoSuchFolderException: No JournalFolder exists with the primary key 2
     at com.liferay.portlet.journal.service.persistence.JournalFolderPersistenceImpl.findByPrimaryKey(JournalFolderPersistenceImpl.java:7729)
     at com.liferay.portlet.journal.service.persistence.JournalFolderPersistenceImpl.findByPrimaryKey(JournalFolderPersistenceImpl.java:7747)
     at com.liferay.portlet.journal.service.impl.JournalFolderLocalServiceImpl.getFolder(JournalFolderLocalServiceImpl.java:248)
     at sun.reflect.GeneratedMethodAccessor1463.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
     at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
     at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
     at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
     at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
     at com.sun.proxy.$Proxy243.getFolder(Unknown Source)
     at com.liferay.portlet.journal.service.JournalFolderLocalServiceUtil.getFolder(JournalFolderLocalServiceUtil.java:413)
     at com.liferay.portlet.journal.model.impl.JournalArticleImpl.getFolder(JournalArticleImpl.java:157)
     at com.liferay.portlet.journal.model.impl.JournalArticleImpl.buildTreePath(JournalArticleImpl.java:64)
     at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.addArticle(JournalArticleLocalServiceImpl.java:376)
     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:606)
     at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
     at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
     at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
     at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
     at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
     at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
     at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
     at com.sun.proxy.$Proxy236.addArticle(Unknown Source)
     at com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil.addArticle(JournalArticleLocalServiceUtil.java:439)
     at com.liferay.portlet.journal.lar.JournalArticleStagedModelDataHandler.doImportStagedModel(JournalArticleStagedModelDataHandler.java:594)
     at com.liferay.portlet.journal.lar.JournalArticleStagedModelDataHandler.doImportStagedModel(JournalArticleStagedModelDataHandler.java:1)
     at com.liferay.portal.kernel.lar.BaseStagedModelDataHandler.importStagedModel(BaseStagedModelDataHandler.java:159)
     ... 32 more

The JournalFolder with the key 2 exists in the LAR package however not in the database (the database is clear).

Any suggestion how to make Liferay import the folders too? (Creating the folders manually is out of scope because I have around 2000 folders I need to import).

Thanks in advance.


回答1:


The issue was that we missed one XML file for the main Portlet of Liferay. After we fixed the references the import worked and the folders could be resolved.

So if you encounter the same problem (folder is missing when importing although the folders are in the LAR package): make sure you reference in manifest.xml to the portlet.xml in the main portlet folder (15) then reference from this portlet.xml to the portlet-data.xml for the same main portlet.



来源:https://stackoverflow.com/questions/25308231/liferay-6-2-lar-import-no-journalfolder-exists-with-the-primary-key-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!