Fórum

Portlet deploy as war outside OSGI , is it possible

Najlaa STITOU, modificado 7 Anos atrás.

Portlet deploy as war outside OSGI , is it possible

New Member Postagens: 10 Data de Entrada: 16/05/16 Postagens Recentes
Hi Everyone,

i was asking if i can access a remote ejb deploy in jee-container through a liferay portlet :

https://web.liferay.com/community/forums/-/message_boards/message/75344718.


Now, as it is impossible to do it directly, can i deploy portlet outside osgi, i wanna say , is there a way to deploy it in JEE-container liferay-portal-wildfly-7.0-ce-ga1-20160331161017956\liferay-portal-7.0-ce-ga1\wildfly-10.0.0\standalone\deployments and make it work as JEE app instead of OSGI bundle.

Is it possible to have an example because i have a bundle example of Portlet.

Thanks in advance.
thumbnail
Juan Gonzalez, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Hi again Najlaa.

In order to deploy portlets you would need a portlet container, so Wildfly wouldn't be enough.
Najlaa STITOU, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

New Member Postagens: 10 Data de Entrada: 16/05/16 Postagens Recentes
Thanks again Juan emoticon, well i am asking if i can deploy a portlet as it is done in previous versions (6.2 for example), it works with EJB call and i dont think there were an OSGI container , correct me if i am wrong , the portlet were able to be deployed inside an ear ..., i saw an example of portlet which have inside it an EJB local call ...

So i am wondering if i can deploy portlet without OSGI specifications

Thank you for your answers
thumbnail
Juan Gonzalez, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Najlaa STITOU:
Thanks again Juan emoticon, well i am asking if i can deploy a portlet as it is done in previous versions (6.2 for example), it works with EJB call and i dont think there were an OSGI container , correct me if i am wrong , the portlet were able to be deployed inside an ear ..., i saw an example of portlet which have inside it an EJB local call ...

So i am wondering if i can deploy portlet without OSGI specifications

Thank you for your answers


I understand your confusion now :-). Before Liferay 7, portlets, packaged as WAR, were deployed by your server container (Tomcat, JBoss, etc), althought using some mechanisms/addons from portlet container (Liferay). Due to that reason, you could use all the features that server makes available (like EJemoticon.

In Liferay 7, there aren't any portlet visible by your server. That means these features aren't available anymore unless you build some custom, let's say, "extender" to make that available for portlets and OSGI. The advantages for this approach are great: server abstraction for example. But you already found some drawbacks: those features aren't available as the only container processing your portlet will be Liferay 7 only.

So, that is the reason it was working fine before, and now it won't work.

If you want to use an EJB, just deploy it like a plain webapp (no portlet) and enable remote services, probably JAX-WS or JAX-RS better than RMI in order to avoid problems when trying to consume those from portlets.

Hope it is clearer for you now.

Thanks!
thumbnail
Ray Augé, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

Liferay Legend Postagens: 1197 Data de Entrada: 08/02/05 Postagens Recentes
You should still be able to lookup EBJs via JNDI as you might have before.

However, in order to access the types you need to make sure they are exported into the OSGi framework. You can do this by adding the package names to the portal property:

    module.framework.system.packages.extra=\
        javax.faces.convert,\
        javax.faces.webapp,\
        \
        #
        # Dynamic References
        #
        \
        com.ibm.crypto.provider,\
        com.mysql.jdbc,\
        com.sun.security.auth.module,\
        org.apache.naming.java,\
        sun.misc,\
        sun.security.provider
thumbnail
Ray Augé, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

Liferay Legend Postagens: 1197 Data de Entrada: 08/02/05 Postagens Recentes
Note however that they still need to be types and EJBs which are visible to the portal's webapp context.
Najlaa STITOU, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

New Member Postagens: 10 Data de Entrada: 16/05/16 Postagens Recentes
Ray Augé:
Note however that they still need to be types and EJBs which are visible to the portal's webapp context.


Hi Ray and Juan emoticon

I tried what you said but it did not make difference , what i did is make jboss-ejb-client-2.1.4.jar provided , it works now and i have got a connection established between client and server according to wildfly log:

12:45:53,618 INFO  [org.jboss.ejb.client.remoting] (default task-1) EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@713c38db, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@85cfefd,channel=jboss.ejb,nodename=desktop-u55pugo]} on channel Channel ID c08665b2 (outbound) of Remoting connection 27687c4a to /127.0.0.1:8180
12:45:59,699 INFO  [org.jboss.ejb.client] (default task-1) JBoss EJB Client version 2.1.4.Final


However, i did have another issue while ejb call , when i debug i found that An array should not be empty EJBClientInterceptor[] registrations in EJBClientContext.

that happend when i call a method of ejb remote service, that means that i can lookup the service ... but i cannot invoke the ejb remote method

This array is initialized by DefaultInterceptorsClientContextInitializer method "initialize", it seems like this method is never called when i make the jboss-client jar provided, it is never reached by the debugger.

when i keep the jboss-client in portlet lib i got the issue i mentioned before:
java.util.ServiceConfigurationError: org.jboss.ejb.client.EJBClientContextInitializer: Provider org.jboss.ejb.client.DefaultInterceptorsClientContextInitializer not a subtype


Could you help me please!emoticonemoticon
thumbnail
Ray Augé, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

Liferay Legend Postagens: 1197 Data de Entrada: 08/02/05 Postagens Recentes
Can you make a tiny github project that reproduces the issue with a README how to setup the EJB and I can try it next week.

- Ray
Najlaa STITOU, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

New Member Postagens: 10 Data de Entrada: 16/05/16 Postagens Recentes
Thanks a lot Ray, i will try to do that emoticon emoticon
Najlaa STITOU, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

New Member Postagens: 10 Data de Entrada: 16/05/16 Postagens Recentes
Thanks Juan, you are right, that is my problem, to fix it, i have deployed the ejb service in JEE container as remote service then when i try to call it using JNDI from the portlet i get this issue: Provider org.jboss.ejb.client.DefaultInterceptorsClientContextInitializer not a subtype at line where i call the lookup method.

I tried to delete the jboss-ejb-client-2.1.4.Final.jar to see if there is a conflict or something else behind that , the lookup works but i have got another issue when i tried to invoke a remote service method due to jboss-ejb jar missing.

i will try to do what Ray suggests and tell you if it works emoticon
thumbnail
Juan Gonzalez, modificado 7 Anos atrás.

RE: Portlet deploy as war outside OSGI , is it possible

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Hi Najlaa,

maybe it could be a good thing you to check what Ray said, as the JNDI is available in OSGI.

Please give it a try, maybe we can try to fix it in the end...