Hi, I try to get the following combo to work.
package my.package.example.sender;
import org.osgi.service.component.annotations.Component;
import com.vaadin.addon.ipcforliferay.LiferayIPC;
import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import lombok.extern.slf4j.Slf4j;
@Widgetset(AppWidgetSet.NAME)
@SuppressWarnings("serial")
@Slf4j
@Component(service = UI.class, property = { "com.liferay.portlet.display-category=category.sample",
"javax.portlet.name=Vaadin8SENDER", "javax.portlet.display-name=Vaadin 8 SENDER",
"javax.portlet.security-role-ref=power-user,user", "com.vaadin.osgi.liferay.portlet-ui=true" })
public class MySenderPortletUI extends UI {
private LiferayIPC liferayIPC;
public MySenderPortletUI() {
liferayIPC = new LiferayIPC();
liferayIPC.extend(this);
final VerticalLayout layout = new VerticalLayout();
setContent(layout);
final Button button = new Button("GO");
button.addClickListener(event -> {
log.info("BUTTON CLICK -> send EVENT");
liferayIPC.sendEvent("buttonClickedIPCEvent", "HALLO WORLD");
});
layout.addComponent(button);
}
and the receiver class …
package my.package.example.receiver;
import org.osgi.service.component.annotations.Component;
import com.vaadin.addon.ipcforliferay.LiferayIPC;
import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import lombok.extern.slf4j.Slf4j;
@Widgetset(AppWidgetSet.NAME)
@SuppressWarnings("serial")
@Slf4j
@Component(service = UI.class, property = { "com.liferay.portlet.display-category=category.sample",
"javax.portlet.name=Vaadin8RECEIVER", "javax.portlet.display-name=Vaadin 8 RECEIVER",
"javax.portlet.security-role-ref=power-user,user", "com.vaadin.osgi.liferay.portlet-ui=true" })
public class MyReceiverPortletUI extends UI {
Label label = new Label("");
private LiferayIPC liferayIPC;
public MyReceiverPortletUI() {
liferayIPC = new LiferayIPC();
liferayIPC.extend(this);
final VerticalLayout layout = new VerticalLayout();
setContent(layout);
layout.addComponent(label);
liferayIPC.addLiferayIPCEventListener("buttonClickedIPCEvent", event -> {
log.info("receive EVENT: " + event.getData());
label.setCaption(event.getData());
});
}
}
I got the following error within the broser (/?debug=)
Received xhr message: for(;;);[{"syncId": 8, "clientId": 7, "changes" : [["change",{"pid":"0"},["0",{"id":"0"}]
]], "state":{"0":{"errorMessage":"<h2>com.vaadin.server.ServerRpcManager$RpcInvocationException: Unable to invoke method sendEvent in com.vaadin.addon.ipcforliferay.shared.LiferayIPCRpc at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:159) at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:116) at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:445) at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:410) at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274) at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:90) at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1601) at com.vaadin.server.VaadinPortlet.handleRequest(VaadinPortlet.java:549) at com.vaadin.server.VaadinPortlet.serveResource(VaadinPortlet.java:633) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:122) at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:85) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:116) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153) at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:62) at org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(DispatchTargets.java:117) at org.eclipse.equinox.http.servlet.internal.servlet.RequestDispatcherAdaptor.forward(RequestDispatcherAdaptor.java:40) at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:528) at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:631) at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:468) at com.liferay.portal.monitoring.internal.portlet.MonitoringInvokerPortlet.serveResource(MonitoringInvokerPortlet.java:303) at com.liferay.portlet.PortletContainerImpl._serveResource(PortletContainerImpl.java:839) at com.liferay.portlet.PortletContainerImpl.serveResource(PortletContainerImpl.java:176) at com.liferay.portlet.SecurityPortletContainerWrapper.serveResource(SecurityPortletContainerWrapper.java:165) at com.liferay.portlet.RestrictPortletContainerWrapper.serveResource(RestrictPortletContainerWrapper.java:173) at com.liferay.portal.kernel.portlet.PortletContainerUtil.serveResource(PortletContainerUtil.java:169) at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:303) at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:159) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:170) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:606) at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:583) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.uploadservletrequest.UploadServletRequestFilter.processFilter(UploadServletRequestFilter.java:93) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:337) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.monitoring.internal.servlet.filter.MonitoringFilter.processFilter(MonitoringFilter.java:181) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318) at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:153) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.uploadservletrequest.UploadServletRequestFilter.processFilter(UploadServletRequestFilter.java:93) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:125) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:337) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:364) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:86) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:261) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:88) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:265) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142) at com.liferay.portal.monitoring.internal.servlet.filter.MonitoringFilter.processFilter(MonitoringFilter.java:181) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394) at com.liferay.portal.servlet.filters.urlrewrite.UrlRewriteFilter.processFilter(UrlRewriteFilter.java:65) at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:168) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:168) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@76e2ad5 at sun.reflect.GeneratedMethodAccessor1275.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.__invoke(DelegatingMethodAccessorImpl.java:43) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java) at java.lang.reflect.Method.invoke(Method.java:498) at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155) ... 168 more </h2>"}}, "types":{"0":"0"}, "hierarchy":{"0":["4","1"]
}, "rpc" : , "meta" : {}, "resources" : {}, "timings":[67, 12]
}]
It is the first time I use Liferay 7 and Vaadin 8. Gradle is also new to me. I have no Idea where to start…
kind regards, markus