Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
sharing service layer between multiple portlets. k venkatesh 25 de abril de 2012 23:50
RE: sharing service layer between multiple portlets. Hitoshi Ozawa 26 de abril de 2012 3:53
RE: sharing service layer between multiple portlets. Jitendra Rajput 26 de abril de 2012 4:46
RE: sharing service layer between multiple portlets. Hitoshi Ozawa 26 de abril de 2012 4:51
RE: sharing service layer between multiple portlets. k venkatesh 26 de abril de 2012 6:04
RE: sharing service layer between multiple portlets. Hitoshi Ozawa 26 de abril de 2012 6:10
RE: sharing service layer between multiple portlets. David H Nebinger 26 de abril de 2012 7:06
RE: sharing service layer between multiple portlets. k venkatesh 26 de abril de 2012 7:18
RE: sharing service layer between multiple portlets. k venkatesh 26 de abril de 2012 7:54
RE: sharing service layer between multiple portlets. David H Nebinger 26 de abril de 2012 8:08
RE: sharing service layer between multiple portlets. Hitoshi Ozawa 26 de abril de 2012 14:13
RE: sharing service layer between multiple portlets. David H Nebinger 26 de abril de 2012 14:45
RE: sharing service layer between multiple portlets. k venkatesh 26 de abril de 2012 22:33
RE: sharing service layer between multiple portlets. k venkatesh 26 de abril de 2012 22:52
RE: sharing service layer between multiple portlets. David H Nebinger 1 de mayo de 2012 10:29
RE: sharing service layer between multiple portlets. Hitoshi Ozawa 1 de mayo de 2012 15:37
RE: sharing service layer between multiple portlets. David H Nebinger 1 de mayo de 2012 16:00
RE: sharing service layer between multiple portlets. k venkatesh 1 de mayo de 2012 21:29
RE: sharing service layer between multiple portlets. k venkatesh 1 de mayo de 2012 21:43
RE: sharing service layer between multiple portlets. Clint Wilde 2 de julio de 2013 16:35
RE: sharing service layer between multiple portlets. David H Nebinger 3 de julio de 2013 5:55
RE: sharing service layer between multiple portlets. Jack Bakker 3 de julio de 2013 11:46
RE: sharing service layer between multiple portlets. Clint Wilde 3 de julio de 2013 15:33
RE: sharing service layer between multiple portlets. k venkatesh 26 de abril de 2012 22:50
k venkatesh
sharing service layer between multiple portlets.
25 de abril de 2012 23:50
Respuesta

k venkatesh

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 20 de febrero de 2012

Mensajes recientes

Hi All.
I am using Liferay6.0.6. I am trying to share my service in another portlet.For this one I placed the service.jar related to portlet which produce the service in tomcat/lib/ext.
whenever run the application, I am getting NUllPointer Exception like below.



java.lang.NullPointerException
at com.sample.service.FooLocalServiceClp.<init>(FooLocalServiceClp.java:389)
at com.sample.service.FooLocalServiceUtil.getService(FooLocalServiceUtil.java:237)
at com.sample.service.FooLocalServiceUtil.getFoo(FooLocalServiceUtil.java:166)
at com.liferay.ajax.AjaxPortlet.serveResource(AjaxPortlet.java:33)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:119)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:635)
at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:747)
at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:504)
at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:871)
at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:613)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:232)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:153)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:508)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:485)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:309)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.themepreview.ThemePreviewFilter.processFilter(ThemePreviewFilter.java:88)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:121)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:182)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:254)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:134)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:309)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.themepreview.ThemePreviewFilter.processFilter(ThemePreviewFilter.java:88)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:110)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:182)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:222)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:45)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:254)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:81)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:179)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:240)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.threadlocal.ThreadLocalFilter.processFilter(ThreadLocalFilter.java:35)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)


If any one knows please reply me.
Thanks in advance.
Hitoshi Ozawa
RE: sharing service layer between multiple portlets.
26 de abril de 2012 3:53
Respuesta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensajes: 7949

Fecha de incorporación: 23 de marzo de 2010

Mensajes recientes

Put portlets in one war file (one project).
Jitendra Rajput
RE: sharing service layer between multiple portlets.
26 de abril de 2012 4:46
Respuesta

Jitendra Rajput

Ranking: Liferay Master

Mensajes: 858

Fecha de incorporación: 7 de enero de 2011

Mensajes recientes

Make sure your portletName-service.jar only available inside tomcat/lib/ext. Remove it from other places if you have placed.
Hitoshi Ozawa
RE: sharing service layer between multiple portlets.
26 de abril de 2012 4:51
Respuesta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensajes: 7949

Fecha de incorporación: 23 de marzo de 2010

Mensajes recientes

Yes, you'll have to delete the jar which you've moved to ext folder from the your-portlet\WEB-INF\lib folder. Otherwise, you'll have duplicated jars which causes error.
k venkatesh
RE: sharing service layer between multiple portlets.
26 de abril de 2012 6:04
Respuesta

k venkatesh

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 20 de febrero de 2012

Mensajes recientes

ya , Whatever you said I followed but the things are not happening,Did I miss anything else here.
Hitoshi Ozawa
RE: sharing service layer between multiple portlets.
26 de abril de 2012 6:10
Respuesta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensajes: 7949

Fecha de incorporación: 23 de marzo de 2010

Mensajes recientes

The best thing to do may be to attach your portlet war files here so other people would be able to look at and see diagnosis the problem.

For starters, what's in the line that's causing null exception?
David H Nebinger
RE: sharing service layer between multiple portlets.
26 de abril de 2012 7:06
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 9234

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

Hitoshi Ozawa:
Yes, you'll have to delete the jar which you've moved to ext folder from the your-portlet\WEB-INF\lib folder. Otherwise, you'll have duplicated jars which causes error.


Sorry, Hitoshi, but everyone seems to think this is still the case when it is not. This is the legacy way of sharing service jars and should not be used in the 6.x series.

The portlets that use the service should list the portlet that provides the service as a required deployment context in liferay-plugin-package.properties.

The IDE will ensure that the service jar is included in the portlet.

This saves the whole issue of copying the jar to tomcat's lib/ext directory, forcing restarts, etc.
k venkatesh
RE: sharing service layer between multiple portlets.
26 de abril de 2012 7:18
Respuesta

k venkatesh

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 20 de febrero de 2012

Mensajes recientes

Thanks david ,
can you give me the syntax for deployment context portlet in Liferay-plugin-package.properties.
k venkatesh
RE: sharing service layer between multiple portlets.
26 de abril de 2012 7:54
Respuesta

k venkatesh

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 20 de febrero de 2012

Mensajes recientes

Hi David,

In my PortletB(Consumer)/liferay-plugin-package.properties I have written the following line.

recommended-deployment-context=PortletA-portlet

PortletA has the services.

when I am deploying portletB, it is deploying PortletA not PortletB. please can u explain for this cause
David H Nebinger
RE: sharing service layer between multiple portlets.
26 de abril de 2012 8:08
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 9234

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

Use the visual editor, the required deployment context is in the lower right corner. Click on the 'add' button and choose the portlet that has the service.

As a required deployment context, portlet B will not deploy until portlet A has been successfully deployed.

Are portlet A and portlet B in the same project? If so, you don't need to do this as portlet B should have access to the service jar already.
Hitoshi Ozawa
RE: sharing service layer between multiple portlets.
26 de abril de 2012 14:13
Respuesta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensajes: 7949

Fecha de incorporación: 23 de marzo de 2010

Mensajes recientes

Sorry David, putting in the ext and deleting from the portlet's lib directory should work. Since it's not, it's probably likely that something else is the cause of the null problem.

Also, this isn't the IDE forum this time. It's a Developer's forum. Shouldn't assume everybody is using IDE.
David H Nebinger
RE: sharing service layer between multiple portlets.
26 de abril de 2012 14:45
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 9234

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

Hmm, I guess it could be just a function of the IDE, but it really is a good one. I haven't really dug any deeper to determine if it was perchance a function of the build and/or deployment process, but it really would make sense if it were...

Using the required deployment context certainly solves many issues w/ copying to the ext directory (i.e. first you deploy, then you copy to the ext directory, delete from the deployed lib directory, restart your application container, ...).

Oh, and I think the NPE occurs if the service jar is deployed but the plugin hosting the service isn't deployed and/or started, one thing that the required deployment context does enforce within the portal runtime...
k venkatesh
RE: sharing service layer between multiple portlets.
26 de abril de 2012 22:33
Respuesta

k venkatesh

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 20 de febrero de 2012

Mensajes recientes

Hi David I used the visual editor and I got the recommende deploy conext

I have written the code in my view.jsp like this in portletB.

1<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
2<%@ page import="com.liferay.producer.service.FooLocalServiceUtil" %>
3
4<portlet:defineObjects />
5
6This is the <b>portletB</b> portlet.
7<%=FooLocalServiceUtil.getFoo(1)%>



I am getting these exceptions.


An error occurred at line: 6 in the generated java file
Only a type can be imported. com.liferay.producer.service.FooLocalServiceUtil resolves to a package

An error occurred at line: 23 in the jsp file: /view.jsp
FooLocalServiceUtil cannot be resolved
20: <portlet:defineObjects />
21:
22: This is the <b>portletB</b> portlet.
23: <%=FooLocalServiceUtil.getFoo(1)%>


Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
at com.liferay.portlet.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:316)
at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:105)
... 196 more
05:27:52,233 ERROR [jsp:154] org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 6 in the generated java file
Only a type can be imported. com.liferay.producer.service.FooLocalServiceUtil resolves to a package

An error occurred at line: 23 in the jsp file: /view.jsp
FooLocalServiceUtil cannot be resolved
20: <portlet:defineObjects />
21:
22: This is the <b>portletB</b> portlet.
23: <%=FooLocalServiceUtil.getFoo(1)%>


Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
at com.liferay.portlet.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:316)
at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:105)
at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:328)
at com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:343)

05:27:52,281 INFO [PluginPackageUtil:1230] Checking for available updates
05:27:52,289 INFO [PluginPackageUtil:1274] Finished checking for available updates in 8 ms
k venkatesh
RE: sharing service layer between multiple portlets.
26 de abril de 2012 22:50
Respuesta

k venkatesh

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 20 de febrero de 2012

Mensajes recientes

Hi Hitoshi ,

yes got it, it is working throgh tomact/lib/ext.What I have done is I removed the data from tomcat/temp folder.Now it is sharing portlet A service in PortletB.

Thank you.
k venkatesh
RE: sharing service layer between multiple portlets.
26 de abril de 2012 22:52
Respuesta

k venkatesh

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 20 de febrero de 2012

Mensajes recientes

Hi david it is working with tomcat/lib/ext,but it is not working through required deployment context.Dis I miss any step.
David H Nebinger
RE: sharing service layer between multiple portlets.
1 de mayo de 2012 10:29
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 9234

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

After adding as a required deployment context in portlet B, you have to re-run service builder in portlet A. I use the visual editor for the service.xml file, and click on the "Build Services" button on the top-right of the overview tab. This will push out the service jar to all portlets that have the required deployment context set, putting the service jar file into their WEB-INF/lib directories.
Hitoshi Ozawa
RE: sharing service layer between multiple portlets.
1 de mayo de 2012 15:37
Respuesta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensajes: 7949

Fecha de incorporación: 23 de marzo de 2010

Mensajes recientes

That doesn't sound too good. I'll essentially have multiple same jar spread across several portlets which I would have to sync everytime I change something. Seems like invitation to trouble.
Probably would have been better if there was an checkbox in IDE to deploy to ext folder instead of portlet's lib.
David H Nebinger
RE: sharing service layer between multiple portlets.
1 de mayo de 2012 16:00
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 9234

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

The IDE (I know this is not the IDE forum) manages the copying when service builder runs.

Yes, each portlet that is consuming the service has a copy of the service jar.

But it does fix the inevitable problem of needing to restart the container when moving jar from the deployed service provider portlet to the ext/lib directory and works on all Liferay supported app servers (not all of them use tomcat's lib/ext directory).

So basically the trade-off is that I can hot deploy both my service providing plugins and my service consuming plugins, all w/o a restart of the app container or access to the filesystem.
k venkatesh
RE: sharing service layer between multiple portlets.
1 de mayo de 2012 21:29
Respuesta

k venkatesh

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 20 de febrero de 2012

Mensajes recientes

Hi David, I will try it and let you know.
k venkatesh
RE: sharing service layer between multiple portlets.
1 de mayo de 2012 21:43
Respuesta

k venkatesh

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 20 de febrero de 2012

Mensajes recientes

HI David,
I have re ran the build-services in portlet A using visual editor and I tested the application,but it is still not recognizing portletA classes in PortletB.Dis I miss any thing here for doing that ne.
Clint Wilde
RE: sharing service layer between multiple portlets.
2 de julio de 2013 16:35
Respuesta

Clint Wilde

Ranking: New Member

Mensajes: 6

Fecha de incorporación: 5 de marzo de 2013

Mensajes recientes

Hi David,

I have a portlet (Provider-portlet) built with ServiceBuilder and I want to share the generated service.jar with another portlet (Consumer-portlet).

I added this line in my liferay-plugin-package.properties: required-deployment-contexts=Provider-portlet

I redeployed the Consumer-portlet, then ran 'build-services' then 'all' from Eclipse.

From everything I am reading this should have deployed the service.jar to the Tomcat/webbapps/Consumer-portletWEB-INF/lib dir but it did not.

is this not correct?

Also when I try to invoke the Consumer-portlet, I get a ClassCastException:

java.lang.ClassCastException: [Lprovider.model.Provider; cannot be cast to [Lprovider.model.Provider;

Can you tell me what I could be doing incorrectly?

Thank you,
Clint
David H Nebinger
RE: sharing service layer between multiple portlets.
3 de julio de 2013 5:55
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 9234

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

The service jar is only copied at build time, not at deployment time...

So when you build services portlet and deploy it, you'll typically need to rebuild/redeploy the dependent portlets (especially when the methods they invoke have a signature change).

ClassCastExceptions are class loader issues, meaning there are two service jars somewhere in the class path of the portlet. If your service jar is in the global lib dir (lib/ext in tomcat), you should not have a service jar anywhere else in the webapps tree. Alternatively it will be an indicator that you are out of sync w/ respect to the different versions of the service jar (newer version in service provider and older version in service consumer).
Jack Bakker
RE: sharing service layer between multiple portlets.
3 de julio de 2013 11:46
Respuesta

Jack Bakker

Ranking: Liferay Master

Mensajes: 794

Fecha de incorporación: 3 de enero de 2010

Mensajes recientes

i still prefer one project/plugin for services and after deploy move the service jar to global classpath for many portlets to consume ; the container restart (lack of hot deploy) is the downside but when versioning multiple portlets connecting to same services... after all Liferay puts its services into global classpaths instead of distributing all over the place

consumption of services and IPC are the multi-portlet challenge these days ; not like it is one web app any more
Clint Wilde
RE: sharing service layer between multiple portlets.
3 de julio de 2013 15:33
Respuesta

Clint Wilde

Ranking: New Member

Mensajes: 6

Fecha de incorporación: 5 de marzo de 2013

Mensajes recientes

Thanks David. I was doing all off that, but the issue was because I was returning CustomObject[] instead of List<CustomObject>. The classloader proxy was not able to handle CustomObject[], but it can handle List<CustomObject>.

I fixed that then redeployed both projects and it worked perfectly.

Thank you!