フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Satish Bhor
How to avoid Liferay to adding jars in portlet on deployment in liferay?
2012/08/28 5:31
答え

Satish Bhor

ランク: New Member

投稿: 17

参加年月日: 2011/12/20

最近の投稿

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
2012/08/28 7:01
答え

David H Nebinger

Community Moderator

ランク: Liferay Legend

投稿: 11294

参加年月日: 2006/09/01

最近の投稿

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
2012/09/02 23:56
答え

Jaynil A Bagdai

ランク: Regular Member

投稿: 120

参加年月日: 2012/03/03

最近の投稿

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
2012/09/03 9:02
答え

David H Nebinger

Community Moderator

ランク: Liferay Legend

投稿: 11294

参加年月日: 2006/09/01

最近の投稿

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
2012/09/12 3:58
答え

Sampsa Sohlman

LIFERAY STAFF

ランク: Regular Member

投稿: 225

参加年月日: 2007/09/27

最近の投稿

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)