留言板

Hibernate Libs Compartilhadas

thumbnail
Victor Menegusso,修改在8 年前。

Hibernate Libs Compartilhadas

Junior Member 帖子: 31 加入日期: 11-3-3 最近的帖子
Olá pessoal, tudo bem? eu estou com vários portlets que utilizam o hibernate, e ate então as lib's do hibernate estão dentro de cada portlet. Todos os portlets funcionam muito bem. O problema é o tamanho dos portlets mais o que eles iram ocupar no PermGen do servidor (Glassfish 3.1.2.2 (build 5) )

Quando coloco a hibernate na pasta [domain/lib] do glassfish o portal para de funcionar, aparentemente devido a conflitos e dependencias.
Pensei também em utilizar o "portal.dependency.jars" do "portlet-plugin-package.properties", mas como eu li no link: "https://www.liferay.com/web/pmesotten/blog/-/blogs/classloading-in-liferay" internamente o liferay ira copiar a lib do classpath dele para o classpath do portlet, logo não solucionaria meu problema de uso de memória.


Acabei lendo que eu poderia isolar as libs do liferay usando o "<class-loader delegate="false" />", mas não acredito que seja uma boa solução.


O que vocês me recomendariam?
thumbnail
David H Nebinger,修改在8 年前。

RE: Hibernate Libs Compartilhadas

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
This is the trap of hibernate/jpa, they just don't work in a portlet scenario.

The only possibility you have is to put all of the hibernate portlets into a single portlet plugin. You can then have a single hibernate dependency, but it will take you some work to combine them together.
thumbnail
Victor Menegusso,修改在8 年前。

RE: Hibernate Libs Compartilhadas

Junior Member 帖子: 31 加入日期: 11-3-3 最近的帖子
David H Nebinger:
This is the trap of hibernate/jpa, they just don't work in a portlet scenario.

The only possibility you have is to put all of the hibernate portlets into a single portlet plugin. You can then have a single hibernate dependency, but it will take you some work to combine them together.




thank David H Nebinger.
thumbnail
Peter Mesotten,修改在8 年前。

RE: Hibernate Libs Compartilhadas

Junior Member 帖子: 45 加入日期: 09-2-4 最近的帖子
Hi Victor,

I saw this thread because my bog post about classloading was mentioned.

In Liferay 6, there is no way to give your portlets a smaller footprint, certainly not for libraries that are also used by Liferay core and thus that cannot be in the global lib path of Tomcat.

Liferay 7 will have more possibilities, as you will be able to abstract the Hibernate libraries away in a separate OSGi module that can then be shared by all the portlet modules that use the Hibernate stack. So you'll have much more reuse and overall a much smaller memory footprint on the server.

Best regards,
Peter
thumbnail
David H Nebinger,修改在8 年前。

RE: Hibernate Libs Compartilhadas

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Peter Mesotten:
Liferay 7 will have more possibilities, as you will be able to abstract the Hibernate libraries away in a separate OSGi module that can then be shared by all the portlet modules that use the Hibernate stack. So you'll have much more reuse and overall a much smaller memory footprint on the server.


It's still not clear, however, if it will be a good idea to ditch SB in lieu of hibernate/jpa. Even in the OSGi container, the new SB builds separate modules to support the sharing of a single implementation across multiple consumers using a service module, a separation that you either may not get or may be forced to implement on your own.
thumbnail
Victor Menegusso,修改在8 年前。

RE: Hibernate Libs Compartilhadas

Junior Member 帖子: 31 加入日期: 11-3-3 最近的帖子
Peter Mesotten:
Hi Victor,

I saw this thread because my bog post about classloading was mentioned.

In Liferay 6, there is no way to give your portlets a smaller footprint, certainly not for libraries that are also used by Liferay core and thus that cannot be in the global lib path of Tomcat.

Liferay 7 will have more possibilities, as you will be able to abstract the Hibernate libraries away in a separate OSGi module that can then be shared by all the portlet modules that use the Hibernate stack. So you'll have much more reuse and overall a much smaller memory footprint on the server.

Best regards,
Peter


Thank Peter Mesotten