掲示板

Liferay Faces and CDI OSGI

thumbnail
6年前 に Fabian Bouché によって更新されました。

Liferay Faces and CDI OSGI

New Member 投稿: 12 参加年月日: 16/04/08 最新の投稿
Hello Liferay Faces!

I've recently had to study the migration of an existing JSF web application as a Liferay Portlet.
The original application consists of a Primefaces application packaged as a war and additional modules including beans and taglibs.

In order to quickly get to something running, I followed this strategy (http://www.byteslounge.com/tutorials/java-ee-cdi-beans-deployed-in-external-library-web-inf-lib-jar-file) where I would include the aforementioned jars inside of the war's WEB-INF/lib.
This would not work, as I ended up with beans scanning issues:

WELD-001408: Unsatisfied dependencies for type AutoConfigBean with qualifiers @Default_  at injection point [BackedAnnotatedField] @Inject private


WELD-ENV-000031: The bean archive reference bundleresource://553.fwk444101119:42/META-INF/beans.xml cannot be handled by any BeanArchiveHandler: [org.jboss.weld.environment.deployment.discovery.FileSystemBeanArchiveHandler@7e1abda1, org.jboss.weld.environment.servlet.deployment.ServletContextBeanArchiveHandler@2a973859]


My feeling is that the WAB generator is not able to handle that.
Besides, this was not really the solution I was looking for as I wanted to retain the modularity in the target architecture.

So now, what I'm looking for is to turn the bean jars as OSGi bean bundles (something like that: https://dev.liferay.com/fr/develop/tutorials/-/knowledge_base/7-0/using-the-wab-generator) and it looks like you have something incubating: https://github.com/ngriffin7a/liferay-cdi-osgi

Would this be the right approach?
Is the current state good enough so that I can try to build something from your samples ? Against which Liferay DXP version should I run it?

Best regards,
Fabian
thumbnail
6年前 に Neil Griffin によって更新されました。

RE: Liferay Faces and CDI OSGI

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Hi Fabian,

If you haven't done so already, I recommend that you watch my Liferay DEVCON 2016 talk titled Developing WABs With a View to the Future. At 23:25 I talked about OSGi RFC 0193. We are currently working on the specification and the reference implementation. I can't provide a release date, but the work is a very high priority right now.

BTW, I also recommend that you read the forum thread titled Unable to get Services, ServiceTracker is empty.

When Liferay releases an implementation of OSGi RFC 0193, it will be possible to publish CDI beans into the OSGi Service Registry. It will also be possible to @Inject OSGi services into CDI beans. Until then however, it will be necessary to keep all your CDI beans in your portlet WAR.

As a first step in helping you with the "Unsatisfied dependencies" problem you encountered, please download our jsf-cdi-applicant-portlet demo and deploy it in your Liferay 7 environment. Please let us know if the portlet UI works well (fill out the applicant form, click submit, etc) in your environment.

Thank you,

Neil