Skip to Main Content

Do / Will Lambdas work as arguments to RMI calls?

ktnagelMay 22 2014

Hello Collegues,

the new Lambdas are a nice feature to enhance abstraction in Java.

Especially interesting are the areas of use for Lambdas that go beyong only using them in Streams.

One of these might be using Predicates as arguments to methods that query data from a repository,

as opposed to using fixed set of upper an lower bounds for comparision in finder calls e.g.

So it would be nice to give the predicate over RMI to a remote session bean method, as an example.

The problem is, however, this fails with an IllegalStateException, probably because the calling context of the Lambda is remote,

and thus cannot be bound to the executing context, even if no resources of the caller are used at all.

The Wildfly 8 Server creates the following stacktrace:

[java] (22.05.2014 12:04:47 MESZ) basisweb.global.BasisClientException: EJBCLIENT000025: No EJB receiver available

for handling [appName:BasisWebServer, moduleName:BasisWebEJB, distinctName:] combination for invocation context org.jbos

s.ejb.client.EJBClientInvocationContext@1d5a4a71

[java] at basisweb.global.BasisClientException.createMappedException(BasisClientException.java:225)
[java] at basisweb.muster.presenter.BlankoPresenter.doLambdaTest(BlankoPresenter.java:67)
[java] at basisweb.muster.presenter.BlankoPresenter.reset(BlankoPresenter.java:50)
[java] at basisweb.muster.presenter.BlankoPresenter.onZuruecksetzen(BlankoPresenter.java:170)
[java] at basisweb.muster.gui.BlankoPanel.doActionPerformed(BlankoPanel.java:116)
[java] at basisweb.global.gui.AbstractMainPanel.actionPerformed(AbstractMainPanel.java:151)
[java] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
[java] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
[java] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
[java] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
[java] at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
[java] at java.awt.Component.processMouseEvent(Component.java:6527)
[java] at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
[java] at java.awt.Component.processEvent(Component.java:6292)
[java] at java.awt.Container.processEvent(Container.java:2234)
[java] at java.awt.Component.dispatchEventImpl(Component.java:4883)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2292)
[java] at java.awt.Component.dispatchEvent(Component.java:4705)
[java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
[java] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
[java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2278)
[java] at java.awt.Window.dispatchEventImpl(Window.java:2739)
[java] at java.awt.Component.dispatchEvent(Component.java:4705)
[java] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
[java] at java.awt.EventQueue.access$400(EventQueue.java:97)
[java] at java.awt.EventQueue$3.run(EventQueue.java:697)
[java] at java.awt.EventQueue$3.run(EventQueue.java:691)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
[java] at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
[java] at java.awt.EventQueue$4.run(EventQueue.java:719)
[java] at java.awt.EventQueue$4.run(EventQueue.java:717)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
[java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
[java] at basisweb.global.gui.BasisEventQueue.dispatchEvent(BasisEventQueue.java:85)
[java] at noname.BasisWaitCursorEventQueue.dispatchEvent(BasisWaitCursorEventQueue.java:70)
[java] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
[java] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
[java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
[java] at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

[java] Caused by: java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName

:BasisWebServer, moduleName:BasisWebEJB, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClien

tInvocationContext@1d5a4a71

[java] at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:749)
[java] at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)
[java] at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
[java] at org.jboss.ejb.client.EJBClientInvocationContext.retryRequest(EJBClientInvocationContext.java:208)
[java] at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:25

6)

[java] at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:26

5)

[java] at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:198)
[java] at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181)
[java] at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144)
[java] at com.sun.proxy.$Proxy10.queryData(Unknown Source)
[java] at basisweb.muster.presenter.BlankoPresenter.doLambdaTest(BlankoPresenter.java:59)
[java] ... 42 more

(the classes basisweb.* are from the application under test)

Is there any chance this will be fixed any time?

(Or does it work with other JEE7 servers? I could not check against glassfish, sorry)

Regards from Germany,

Thomas Nagel

Comments
Post Details
Added on May 22 2014
0 comments
1,018 views