Fórum

Portlet using classes from EXT plugin

Petr Vašek, modificado 11 Anos atrás.

Portlet using classes from EXT plugin

Junior Member Postagens: 68 Data de Entrada: 26/06/12 Postagens Recentes
HI all, I have EXT plugin where i overwriting 2 liferay classes and i have some my classes (etc. cz.mycompany.orgconfig.myclass). So next i have second simple project as Portlet and i need use my classess from EXT plugin. When i added EXT plugin as "Project" to buildpath so eclipse says everything OK but tomcat throw java.lang.NoClassDefFoundError: cz.mycompany.orgconfig.myclass.

I tried add EXT plugin library to Portlet as compile *.jar but without possitve result.

Please what i do wrong ?

Thank you
thumbnail
Ahmed Hasan, modificado 11 Anos atrás.

RE: Portlet using classes from EXT plugin

Expert Postagens: 306 Data de Entrada: 13/04/07 Postagens Recentes
Hi Petr,

This may compile as you've added this as a project in the workspace of eclipse. This will not work during run-time as the new class you've written is not visible to your portlet.

In order to make this work, please do the following:

1. Write your new class inside ext-service folder of ext-plugin and deploy the ext plugin.

2. Deploy the ext-plugin and restart the server.

3. Now the new class / API should not give any problem.

Some time, you may also run into issues during deployment of the ext-plugin if the configuration is not project. In such cases, you've to manually copy the "ext-plugin-ext-service.jar" manually inside the "tomcat/lib" folder and restart the server

Hope this answer helps you.
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: Portlet using classes from EXT plugin

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
Petr Vašek:
I tried add EXT plugin library to Portlet as compile *.jar but without possitve result.

Please what i do wrong ?


So here's the thing...

Just because code is available in core (either in portal-impl.jar or in your EXT plugin), that doesn't mean the code is available in your portlet(s). The other projects need some other mechanism to use jars from the core in development and deployment...

And there happens to be such a mechanism in the liferay-plugin-package.properties file, under the "Portal Dependency Jars" section, but this only allows for declaring a dependency on a portal jar file (not a class file).

So your shared code you should bundle into a jar and deploy in the EXT plugin's docroot/WEB-INF/ext-lib/portal directory. After deployment, you can then put the dependency in the other projects' liferay-plugin-package.properties file and all is well...