Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
149 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...