Fórumok

Ajax IPC sharing classes between wars

Gaston Artemski, módosítva 14 év-val korábban

Ajax IPC sharing classes between wars

Junior Member Bejegyzések: 70 Csatlakozás dátuma: 2009.04.27. Legújabb bejegyzések
Hallo everybody,

I analyzed Neil Griffins sample-icefaces-ipc-ajax-push-portlet.war and adapted it for my needs.
I have just one question:

If 2 or more wars need the same class - like CustomerListModel out of Neils sample is needed in both portlets but there are in the same war in his sample - what is the preferred way to achieve this?

Example:

War1 sets the attributes for the class Customer and War2 wants to read these attributes, so both wars needs the class Customer.

I would copy in this case the Customer.class to tomcat/lib or to tomcat/webapps/ROOT .
But I am not sure if this is the best solution so I would like to hear your comments.

Greetings

Gaston
thumbnail
Tomas Polesovsky, módosítva 14 év-val korábban

RE: Ajax IPC sharing classes between wars

Liferay Master Bejegyzések: 676 Csatlakozás dátuma: 2009.02.13. Legújabb bejegyzések
Hi,

the standard java solution is to create separate jar file with common classes and add the jar into both war files.

If you want to see the class in all web apps, you should zip it into some jar and put into tomcat lib/ext folder. If you put the class somewhere in the tomcat/webapps/ROOT there is chance that your classloader won't find it because standard wars in tomcat don't see each other's classloader.
Gaston Artemski, módosítva 14 év-val korábban

RE: Ajax IPC sharing classes between wars

Junior Member Bejegyzések: 70 Csatlakozás dátuma: 2009.04.27. Legújabb bejegyzések
Hi Tomas,

thank you for your answer.
But if I would put the mycustom.jar with my classes to tomcat/webapps/ROOT and set portal-dependency-jars=mycustom.jar in the liferay-plugin-package.properties of the both war this jar should be founded...or I am not allright?

Greetings Gaston
thumbnail
Tomas Polesovsky, módosítva 14 év-val korábban

RE: Ajax IPC sharing classes between wars

Liferay Master Bejegyzések: 676 Csatlakozás dátuma: 2009.02.13. Legújabb bejegyzések
Hi,

yes, it should be found. Just put the jar into the tomcat/webapps/ROOT/WEB-INF/lib folder.

But you get the same functionality as when you put the jar in both wars before deploy. (BaseDeployer.java line 252).


-- tom
vasu kumar, módosítva 13 év-val korábban

RE: Ajax IPC sharing classes between wars

New Member Bejegyzések: 2 Csatlakozás dátuma: 2010.03.22. Legújabb bejegyzések
Hi,

Did u got final result.