Fórum

ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

Gabriel Del Canto, modificado 7 Anos atrás.

ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

New Member Postagens: 3 Data de Entrada: 22/12/16 Postagens Recentes
Hello,

I'm virtually new to Liferay and I've crashed with an issue that I can't solve and haven't been able to find documentation about.

I'm currently working with Liferay 7 (liferay-ce-portal-7.0-ga3 bundled with tomcat-8.0.32) in Liferay IDE.

I've created a Plugin Project and then two MVC Portlets, both working with CSS and Bootstrap. One uses pure JavaScript and the other AngularJS for their front end logic.

For bussiness rules I need to link one Portlet to another through an URL.
In order to do this I have to instantiate a ThemeDisplay object on my Portlet.java file to get the Portlet ID by doing
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
themeDisplay.getPortletDisplay().getId()


When I write and compile this line on the IDE there's no problem at all, however when I try to show the Portlet, the server throws me a NoClassFoundException
com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/liferay/portal/theme/ThemeDisplay


I've googled in which .jar is this class and the answer was in "portal-service.jar" that I'm including in my project with Maven

<dependency>
    <groupid>com.liferay.portal</groupid>
    <artifactid>portal-service</artifactid>
    <version>${liferay.version}</version>
    <scope>provided</scope>
</dependency>


I've read that this class and some others are now in other packages (in this case is com.liferay.portal.kernel.theme.ThemeDisplay).

So my question is, do I need to add a new .jar library to access correctly to this class? if not, is there any other solution for this? or even, is there any other way (discarding of course doing it on the jsp page) to jump from PortletA to PortletB (passing data from A to B ) when submitting information?.

Thank you very much in advance for your help!.

Regards!.
thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
You're mixing Liferay version details. Anything that says "portal-service" is from Liferay 6 and earlier. Anything referring to "portal-kernel" is for Liferay 7 CE/Liferay DXP.

Also, portlets are intended to be separate apps and they do not normally share data between them.
Gabriel Del Canto, modificado 7 Anos atrás.

RE: ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

New Member Postagens: 3 Data de Entrada: 22/12/16 Postagens Recentes
David H Nebinger:
You're mixing Liferay version details. Anything that says "portal-service" is from Liferay 6 and earlier. Anything referring to "portal-kernel" is for Liferay 7 CE/Liferay DXP.

Also, portlets are intended to be separate apps and they do not normally share data between them.


Oh! thanks!, that makes a lot of sense, but, what's the correct way to create a URL to a Portlet with Liferay 7?.

And about that portlets are intended to be separate apps and they do not normalally share data, that's because there's some kind of problem when you do that or because their are not thinked for that and in order to achieve that I have to do a workaround?.

And finally, is my idea or there's no much info about Liferay 7 development?, the most things I've found are about Liferay 6.2 or lower.

Thanks again!.
Gabriel Del Canto, modificado 7 Anos atrás.

RE: ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

New Member Postagens: 3 Data de Entrada: 22/12/16 Postagens Recentes
Gabriel Del Canto:
David H Nebinger:
You're mixing Liferay version details. Anything that says "portal-service" is from Liferay 6 and earlier. Anything referring to "portal-kernel" is for Liferay 7 CE/Liferay DXP.

Also, portlets are intended to be separate apps and they do not normally share data between them.


Oh! thanks!, that makes a lot of sense, but, what's the correct way to create a URL to a Portlet with Liferay 7?.

And about that portlets are intended to be separate apps and they do not normalally share data, that's because there's some kind of problem when you do that or because their are not thinked for that and in order to achieve that I have to do a workaround?.

And finally, is my idea or there's no much info about Liferay 7 development?, the most things I've found are about Liferay 6.2 or lower.

Thanks again!.


Sorry I meant how to get the Portlet Id programmatically in Liferay 7, given that ThemeDisplay won't work for this Liferay version.

Regards!.