留言板

ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

Gabriel Del Canto,修改在7 年前。

ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

New Member 帖子: 3 加入日期: 16-12-22 最近的帖子
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,修改在7 年前。

RE: ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
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,修改在7 年前。

RE: ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

New Member 帖子: 3 加入日期: 16-12-22 最近的帖子
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,修改在7 年前。

RE: ThemeDisplay is throwing NoClassDefFoundError on Liferay 7

New Member 帖子: 3 加入日期: 16-12-22 最近的帖子
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!.