Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Tobias Liefke
Use features of the JEE application server in Liferay 7
August 24, 2017 5:49 AM
Answer

Tobias Liefke

Rank: Junior Member

Posts: 64

Join Date: November 23, 2012

Recent Posts

As many before I'm just migrating a Liferay 6.2 app to Liferay 7.

The problem is: the app is an JEE app and makes heavy use of the different features of the JEE application server like JSF, CDI, JPA/JTA, Bean Validation, JMS, JAAS...

First I was happy that there is now a Liferay/WildFly bundle.

And than I've checked the demo portlets and maven archetypes, read the threads about JSF+CDI in Liferay 7 and watched Neils DEVCON 2016 talk and I noticed that the WARs (respective WABs) always use their own JSF and CDI implementation and never use the one of the application server. Even on DEVCON Neil only thought about providing the JSF/CDI modules as OSGI bundles - which would still be different from the ones from the application server.

So I wonder, is it even possible to use the JSF/CDI implementation of the application server like before? And how would I access all the other features of the JEE server? If I drop JSF/CDI implementation of the application server and split the app into a portlet.wab and a service.war - how would I access the services from within the portlets / controller beans?

Another thought which came into my mind, I hope it was not asked to often before: Why is Liferay still shipped within a web/application server? Many other OSGI web applications I know of simply integrate Jetty as OSGI module to handle the web requests.
Ray Augé
RE: Use features of the JEE application server in Liferay 7
August 24, 2017 7:18 AM
Answer

Ray Augé

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1196

Join Date: February 7, 2005

Recent Posts

Tobias, thanks for your question. Give me a little time to collect my thoughts on this. This is a tough question which deserves a well formulated answer.
Tobias Liefke
RE: Use features of the JEE application server in Liferay 7
September 4, 2017 8:39 AM
Answer

Tobias Liefke

Rank: Junior Member

Posts: 64

Join Date: November 23, 2012

Recent Posts

I had some time to test things out and as far as I can see, these are the possible solutions:

  • I rewrite the whole application as OSGI bundle, ignore the JEE frameworks (except JSF and CDI) and try to use the counterparts in Liferay, where they exist. Beside from the costs of this work: The result will be a Liferay specific application - I can't use the result on any other portal.
  • I integrate all the required JEE frameworks into the OSGI bundle. I will somehow reinvent the wheel, because I will have to do all the things that the application server is usually doing for me.
  • I split my application into a portlet part ( WAB ) and a service part ( WAR ). Biggest problem is the class visibility of the interfaces and model objects. As long as I don't want to use serialization I will have to ensure that both parts use the same class loader for theses classes, for example by adding the classes to the application server scope (in the terminology of WildFly: a "module").
  • I still create the portlets in a JEE WAR and configure it like the WARs in Pre-Liferay-7: Add PluginContextListener and similar to the web.xml. I don't know if this will be supported by future Liferay versions - but for know this is working. Two problems arise: I can't use the bundle com.liferay.faces.bridge.ext, because that one is expecting the portlet app to be a WAB. And I don't have access to the classes of any OSGI bundle. For the latter I have modified my class loader to load the required OSGI bundles as well into my module.


For now I'm using the JEE WAR approach, because it makes the migration easier for me. But I'm still interested in your thoughts on these or other options.