[jboss-jira] [JBoss JIRA] (WFLY-3254) Wildfly unable to register websocket endpoint if there is a lambda in its code

Viktor Gamov (JIRA) issues at jboss.org
Sun Apr 13 02:48:33 EDT 2014


Viktor Gamov created WFLY-3254:
----------------------------------

             Summary: Wildfly unable to register websocket endpoint if there is a lambda in its code
                 Key: WFLY-3254
                 URL: https://issues.jboss.org/browse/WFLY-3254
             Project: WildFly
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Web (Undertow)
    Affects Versions: 8.0.0.Final
            Reporter: Viktor Gamov
            Assignee: Stuart Douglas


Trying to programmatically register WebSocket endpoint with following code

public class BidEndpointApi extends Endpoint {
    @Override
    public void onClose(Session session, CloseReason closeReason) {
        System.err.println("Closing: " + closeReason.getReasonPhrase());
    }

    @Override
    public void onError(Session session, Throwable t) {
        System.err.println("Error: " + t.getLocalizedMessage());
    }

    @Override public void onOpen(Session session, EndpointConfig config) {
        final Session mySession = session;
        session.addMessageHandler((MessageHandler.Whole<String>) message -> {
            try {
                mySession.getBasicRemote().sendText(
                    "[Server speaking]: Got your message" + message + "Sending it back to you");
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
    }
}


Application starts and operates normally but when I try to hit this websocket endpoint from JavaScript client getting following server-side exception

[31m02:46:56,438 ERROR [io.undertow.request] (default task-9) Blocking request failed HttpServerExchange{ GET /auction_jaxrs-1.0/bidprog}: java.lang.IllegalStateException: UT003007: Unable to detect MessageHandler type for class com.farata.course.mwd.auction.websocket.BidEndpointApi$$Lambda$1/662246937
	at io.undertow.websockets.jsr.util.ClassUtils.getHandlerTypes(ClassUtils.java:64)
	at io.undertow.websockets.jsr.FrameHandler.addHandler(FrameHandler.java:328)
	at io.undertow.websockets.jsr.UndertowSession.addMessageHandler(UndertowSession.java:99)
	at com.farata.course.mwd.auction.websocket.BidEndpointApi.onOpen(BidEndpointApi.java:25)
	at io.undertow.websockets.jsr.EndpointSessionHandler.onConnect(EndpointSessionHandler.java:81)
	at io.undertow.websockets.jsr.JsrWebSocketFilter$1.handleUpgrade(JsrWebSocketFilter.java:115)
	at io.undertow.server.protocol.http.HttpReadListener.exchangeComplete(HttpReadListener.java:244)
	at io.undertow.server.protocol.http.HttpServerConnection.exchangeComplete(HttpServerConnection.java:218)
	at io.undertow.server.HttpServerExchange.invokeExchangeCompleteListeners(HttpServerExchange.java:1090)
	at io.undertow.server.HttpServerExchange.terminateResponse(HttpServerExchange.java:1310)
	at io.undertow.server.Connectors.terminateResponse(Connectors.java:69)
	at io.undertow.server.protocol.http.ServerFixedLengthStreamSinkConduit.channelFinished(ServerFixedLengthStreamSinkConduit.java:33)
	at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.exitFlush(AbstractFixedLengthStreamSinkConduit.java:249)
	at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.flush(AbstractFixedLengthStreamSinkConduit.java:183)
	at org.xnio.conduits.ConduitStreamSinkChannel.flush(ConduitStreamSinkChannel.java:162) [xnio-api-3.2.0.Final.jar:3.2.0.Final]
	at io.undertow.channels.DetachableStreamSinkChannel.flush(DetachableStreamSinkChannel.java:100)
	at org.xnio.channels.Channels.flushBlocking(Channels.java:63) [xnio-api-3.2.0.Final.jar:3.2.0.Final]
	at io.undertow.servlet.spec.ServletOutputStreamImpl.close(ServletOutputStreamImpl.java:623)
	at io.undertow.servlet.spec.HttpServletResponseImpl.closeStreamAndWriter(HttpServletResponseImpl.java:451)
	at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:525)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:287)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:168)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0]
	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.8.0]



Environment banner

========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /Users/apple/projects/screencast2/wildfly-8.0.0.Final

  JAVA: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java

  JAVA_OPTS:  -server -XX:+UseCompressedOops -Djboss.bind.address.management=127.0.0.1 

=========================================================================

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list