Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Meera Prince
How to share java class between to plugin portlets?
12 de febrero de 2013 22:00
Respuesta

Meera Prince

Ranking: Liferay Legend

Mensajes: 1110

Fecha de incorporación: 8 de febrero de 2011

Mensajes recientes

HI ALL
I have PortletA have one java class called X.java class.
I have another portlet PortletB so that i want load X.java class in PortletB.

If we use portlal class loader then i need to put jar file in tomacta/lib/ext i don't want do this. without ding all i want load x.java class in PortletB.


Regards,
Meera Prince
Kowbathullah Gnaniyar
RE: How to share java class between to plugin portlets?
13 de febrero de 2013 1:49
Respuesta

Kowbathullah Gnaniyar

Ranking: Liferay Master

Mensajes: 608

Fecha de incorporación: 19 de diciembre de 2007

Mensajes recientes

As both are in different context, you cannot access the API from one to another portlet . But I am not sure whether any possibilities are there.

But, you can achieve If 2 portets are in same WAR.

If you want to have the control for transaction service of another portlet, then you can inject the package thorugh service.xml.
Meera Prince
RE: How to share java class between to plugin portlets?
13 de febrero de 2013 3:08
Respuesta

Meera Prince

Ranking: Liferay Legend

Mensajes: 1110

Fecha de incorporación: 8 de febrero de 2011

Mensajes recientes

Hi Gnaniyar Zubair,

Those are two different contexts.
i want solution like following

PortalClassLoaderUtil.getClassLoader().loadClass("com.liferay.portal.model.impl.UserImpl")

Ex:
PortalClassLoaderUtil.getClassLoader().loadClass("com.liferay.portal.model.impl.UserImpl");

For this class should be available in global class path.



Regards,
Meera Prince
Masroor Khan
RE: How to share java class between to plugin portlets?
13 de febrero de 2013 3:25
Respuesta

Masroor Khan

Ranking: Regular Member

Mensajes: 119

Fecha de incorporación: 9 de septiembre de 2008

Mensajes recientes

Hi,

If you want to use like
PortalClassLoaderUtil.getClassLoader().loadClass("com.liferay.portal.model.impl.UserImpl");

you need to put your portlet service jar file to tomcat/lib/ext


Regards,

Masroor
Meera Prince
RE: How to share java class between to plugin portlets?
13 de febrero de 2013 3:33
Respuesta

Meera Prince

Ranking: Liferay Legend

Mensajes: 1110

Fecha de incorporación: 8 de febrero de 2011

Mensajes recientes

Hi Masroor Khan,
Yes your correct.. but i dont wana do such things. is there any possibility to load portlet class into other portlet.
I have seen like this code
ClassLoader classLoader = (ClassLoader)PortletBeanLocatorUtil.locate(ClpSerializer.SERVLET_CONTEXT_NAME,"portletClassLoader");
classLoader. loadClass("your portlet class name with fully qualified name");

but here also service jar should avilable in tomcat/lib/ext


Regards,
Meera Prince
Masroor Khan
RE: How to share java class between to plugin portlets?
13 de febrero de 2013 3:45
Respuesta

Masroor Khan

Ranking: Regular Member

Mensajes: 119

Fecha de incorporación: 9 de septiembre de 2008

Mensajes recientes

Hi,

yes service jar should avilable in tomcat/lib/ext

or As Gnaniyar Zubair suggested you need to keep both portlet in same war file.


Regards,

Masroor Khan
Meera Prince
RE: How to share java class between to plugin portlets?
13 de febrero de 2013 3:46
Respuesta

Meera Prince

Ranking: Liferay Legend

Mensajes: 1110

Fecha de incorporación: 8 de febrero de 2011

Mensajes recientes

HI thanks Masroor Khan ,
Ya understand the concept i am looking for the another alternative solutions.

Regards,
Meera Prince
Kowbathullah Gnaniyar
RE: How to share java class between to plugin portlets?
13 de febrero de 2013 3:50
Respuesta

Kowbathullah Gnaniyar

Ranking: Liferay Master

Mensajes: 608

Fecha de incorporación: 19 de diciembre de 2007

Mensajes recientes

portal class loader also will find the jar file from global level. emoticon

If you have more dependencies with other portlets, you can create in one WAR file.
Meera Prince
RE: How to share java class between to plugin portlets?
13 de febrero de 2013 4:28
Respuesta

Meera Prince

Ranking: Liferay Legend

Mensajes: 1110

Fecha de incorporación: 8 de febrero de 2011

Mensajes recientes

Thank you Gnaniyar Zubair,

HI please give me solution for this
required-deployment -context property not working in liferay 6.0.6.

https://www.liferay.com/community/forums/-/message_boards/message/13505223

Regards,
Meera Prince
Sreeja Surendranath
RE: How to share java class between to plugin portlets?
8 de julio de 2014 3:49
Respuesta

Sreeja Surendranath

Ranking: New Member

Mensajes: 15

Fecha de incorporación: 8 de enero de 2014

Mensajes recientes

Hi,

In this regard, could you please clarify this query as well?

Are there chances for any conflicts if two wars are deployed in the same page and have a class with same name and package structures in both of them?
eg: portlet A has com.portlet.util.Utility
portlet B also has com.portlet.util.Utility
and both are deployed in the same page. But both has different methods.

The context is that I got a method not found exception in portlet A when it actually has the method in Utility. But the Utility class in B does not have that method.

Please help.