Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Satish Bhor
How to avoid Liferay to adding jars in portlet on deployment in liferay?
28 de Agosto de 2012 05:31
Resposta

Satish Bhor

Ranking: New Member

Mensagens: 17

Data de entrada: 20 de Dezembro de 2011

Mensagens recentes

Hi All,
I have created shared lib folder there i have kept all jar files global level and i dont want liferay to add jars to portles WEB-INF/lib folders,Liferay adds some jars on portlet or theme deployment in WEB-INF/lib ,How i can avoid liferay to add jars to portlets and themes.


Thank you...
Satish.
David H Nebinger
RE: How to avoid Liferay to adding jars in portlet on deployment in lifera
28 de Agosto de 2012 07:01
Resposta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensagens: 11046

Data de entrada: 1 de Setembro de 2006

Mensagens recentes

First of all using global jars is generally a bad practice. It means that all apps must use the same jar versions, and you will sometimes encounter problems trying to upgrade versions (i.e. Liferay uses Lucene, but if you put lucene jars as global jars and try to upgrade lucene yourself, you may have Liferay compatibility issues).

Second of all, class loader is first-come, first-serve with the global jars taking priority. When a global jar is loaded, that one will be used, the local one will be ignored.

So whether the jars are copied or not, it doesn't matter as they would not be used.
Jaynil A Bagdai
RE: How to avoid Liferay to adding jars in portlet on deployment in lifera
2 de Setembro de 2012 23:56
Resposta

Jaynil A Bagdai

Ranking: Regular Member

Mensagens: 120

Data de entrada: 3 de Março de 2012

Mensagens recentes

Hi David,

I do have same problem. In my project I am using spring framework for portlet development so i will be needing all spring jars at lib folder of portlet.
Now when deployment done of all portlets, all spring jars being copied in lib folder and due to limitation of resources in server "out of memory" exception comes.

I do have more than 70 portlets in my project. Any idea that if I want to move all these spring jars at global level how can I do that?
David H Nebinger
RE: How to avoid Liferay to adding jars in portlet on deployment in lifera
3 de Setembro de 2012 09:02
Resposta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensagens: 11046

Data de entrada: 1 de Setembro de 2006

Mensagens recentes

You can move the spring jars to the global lib/ext, but you have to understand the implications of doing this...

The global lib/ext jars will always take precedence over jars in the WEB-INF/lib folder. This means that every web application that you deploy to your tomcat container will be using the same version of Spring across the board. This may or may not be a problem for you depending upon your environment.

You should always use the versions that come with the Liferay bundle. If you try to use a different version, you will have to fully test everything to ensure it is working correctly.

Note that promoting some jars to the global lib/ext directory sometimes will require other jars be promoted. At startup or usage, you may see weird class not found or other classloader-related exceptions. These are typically resolved by promoting the related jars, although I'm not aware of any defined list that would help you handle the promotion.
Sampsa Sohlman
RE: How to avoid Liferay to adding jars in portlet on deployment in lifera
12 de Setembro de 2012 03:58
Resposta

Sampsa Sohlman

LIFERAY STAFF

Ranking: Regular Member

Mensagens: 225

Data de entrada: 27 de Setembro de 2007

Mensagens recentes

Hi Jaynil

Jaynil A Bagdai:
I do have more than 70 portlets in my project. Any idea that if I want to move all these spring jars at global level how can I do that?


If you are using only services and (Spring MVC I have not tried) you can use Liferay interal Spring too so your portlet application will come lighter.

Add following to /WEB-INF/web.xml

1<context-param>
2      <param-name>portalContextConfigLocation</param-name>
3      <param-value>/WEB-INF/applicationContext.xml</param-value>
4</context-param>


and create /WEB-INF/applicationContext.xml


1<beans .....>
2   
3    <bean id="my.service.MyService" class="my.service.MyServiceImpl"/>
4</beans>


These services are also visible to other web applications and to theme with PortletBeanLocatorUtil:
1PortletBeanLocatorUtil
2                    .locate(servletContextName, "my.service.MyService");


If you want that other applications are able to see your pojos/intefaces then copy those to other jar file and put that under tomcat classloader/<tomcat>/lib (but carefully minimize the depedencies, since you have to those too)