Fórum

I can't create a journalArticle (Liferay DXP)

Alejandro Núñez, modificado 7 Anos atrás.

I can't create a journalArticle (Liferay DXP)

New Member Postagens: 4 Data de Entrada: 28/09/16 Postagens Recentes
Greetings to all,

I'm working in Liferay DXP (trial version) with Wildfly 10.0.0 using sdk plugins from liferay 7 ga1 and i'm trying to create a journalArticle programatically. I think the issue is that i haven't the corresponding jars of this entity, but i'm not sure.

Before this, I wanted to create a structure programatically with the DDMStructureLocalServiceUtil but didn't work. I was examining the api Liferay 7 too much and I realized that the DDMStructureLocalServiceUtil class was replaced by DDMStructureManagerUtil class, and so does with DDMSTemplateManagerUtil instead of DDMTemplateLocalServiceUtil. Using this new classes it worked fine.

And now i'm trying to create a journalArticle but i don't know how to do that without the JournalArticleLocalServiceUtil class beacuse the jars are missed or removed in this version, i don't know.
I tried to import the JournalArticle jars in Eclipse but it didn't work, because by using the JournalArticleLocalServiceUtil to create a journalArticle like:

JournalArticleLocalServiceUtil.addArticle(userId, groupId, parentFolderId, titleMap,
descriptionMap, content, ddmStructure.getStructureKey(),
ddmTemplate.getTemplateKey(), serviceContext);


i get an error like this:

java.lang.ClassCastException: com.sun.proxy.$Proxy489 cannot be cast to com.liferay.journal.service.JournalArticleLocalService

Also i got the same failure when i used the DDMStructureLocalServiceUtil and DDMTemplateLocalServiceUtil classes, but i managed to fix it replacing them by the new services commented above.

I'd like to know what i'm doing wrong.

Thanks in advance!
thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: I can't create a journalArticle (Liferay DXP)

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
A one line exception message is not going to lead to a reasonable response. I can't even tell what point in the code you may be in...

When posting errors, be sure to include the complete stack trace...
chris jasso, modificado 7 Anos atrás.

RE: I can't create a journalArticle (Liferay DXP)

New Member Postagens: 4 Data de Entrada: 24/10/16 Postagens Recentes
I'm having the exact same error when trying to get web content inside a portlet
here is the complete stack trace


java.lang.ClassCastException: com.sun.proxy.$Proxy466 cannot be cast to com.liferay.journal.service.JournalArticleService
	at com.liferay.journal.service.JournalArticleServiceUtil.getService(JournalArticleServiceUtil.java:1992)
	at com.liferay.journal.service.JournalArticleServiceUtil.getArticlesByStructureId(JournalArticleServiceUtil.java:694)
	at com.thomsonreuters.biva.NewsSlider.doView(NewsSlider.java:48)
	at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:302)
	at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:471)
	at javax.portlet.GenericPortlet.render(GenericPortlet.java:262)
	at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.render(MVCPortlet.java:291)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:57)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:57)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:57)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:57)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:57)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:57)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
thumbnail
Gustavo Oliveira, modificado 7 Anos atrás.

RE: I can't create a journalArticle (Liferay DXP)

Junior Member Postagens: 98 Data de Entrada: 23/09/15 Postagens Recentes
Im trying to use JournalArticleLocalServiceUtil on a WAB portlet (Maven).

pom.xml:

		<dependency>
		    <groupid>com.liferay</groupid>
		    <artifactid>com.liferay.journal.api</artifactid>
		    <version>2.0.0</version>
		    <scope>provided</scope>
		</dependency>
		<dependency>
		    <groupid>com.liferay.portal</groupid>
		    <artifactid>com.liferay.portal.kernel</artifactid>
		    <version>2.0.0</version>
		    <scope>provided</scope>
		</dependency>
<br><br>Tried somethins simple as:<br><pre><code> JournalArticle article = JournalArticleLocalServiceUtil.getArticle(34002); System.out.println(article); </code></pre><br><br>Got the same error:<br><strong>java.lang.ClassCastException: com.sun.proxy.$Proxy464 cannot be cast to com.liferay.journal.service.JournalArticleLocalService</strong>
chris jasso, modificado 7 Anos atrás.

RE: I can't create a journalArticle (Liferay DXP)

New Member Postagens: 4 Data de Entrada: 24/10/16 Postagens Recentes
i found a solution, in this link https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/adapting-to-liferay-7s-api-with-the-code-upgrade-tool, the problem was that portal already had JournalArticle api and the jar inside portlet was causing the problem, the solution is excluding the jar in liferay-plugin-package.properties add this at the end:

deploy-excludes=\
**/WEB-INF/lib/com.liferay.journal.api-2.2.1.jar

sorry for bad english
Ashish Bijlwan, modificado 7 Anos atrás.

RE: I can't create a journalArticle (Liferay DXP)

New Member Postagens: 7 Data de Entrada: 06/01/17 Postagens Recentes
chris jasso:
i found a solution, in this link https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/adapting-to-liferay-7s-api-with-the-code-upgrade-tool, the problem was that portal already had JournalArticle api and the jar inside portlet was causing the problem, the solution is excluding the jar in liferay-plugin-package.properties add this at the end:

deploy-excludes=\
**/WEB-INF/lib/com.liferay.journal.api-2.2.1.jar

sorry for bad english



yes....this is the best solution for this type of problem........
thumbnail
Megesh Damre, modificado 6 Anos atrás.

RE: I can't create a journalArticle (Liferay DXP)

New Member Postagens: 24 Data de Entrada: 27/04/17 Postagens Recentes
chris jasso:
i found a solution, in this link https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/adapting-to-liferay-7s-api-with-the-code-upgrade-tool, the problem was that portal already had JournalArticle api and the jar inside portlet was causing the problem, the solution is excluding the jar in liferay-plugin-package.properties add this at the end:

deploy-excludes=\
**/WEB-INF/lib/com.liferay.journal.api-2.2.1.jar

sorry for bad english




Thanks chris for share solution
This is way to use liferay.journal.api and achieve the functionality emoticon