Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undertow websockets extension does not register service provider for javax.websocket.server.ServerEndpointConfig.Configurator #7509

Closed
jamesnetherton opened this issue Mar 2, 2020 · 1 comment · Fixed by #7542
Labels
kind/bug Something isn't working
Milestone

Comments

@jamesnetherton
Copy link
Contributor

In native mode, when connecting to web socket endpoints that were configured programmatically (E.g a class that extends javax.websocket.Endpoint). I get the following exception:

2020-03-02 10:04:54,746 ERROR [io.und.req.io] (executor-thread-1) Exception handling request a66824b3-c65b-46d6-9be8-39f804502324-1 to /simple: java.lang.RuntimeException: Cannot load platform configurator
	at javax.websocket.server.ServerEndpointConfig$Configurator.fetchContainerDefaultConfigurator(ServerEndpointConfig.java:96)
	at javax.websocket.server.ServerEndpointConfig$Configurator.getContainerDefaultConfigurator(ServerEndpointConfig.java:101)
	at javax.websocket.server.ServerEndpointConfig$Configurator.checkOrigin(ServerEndpointConfig.java:155)
	at io.undertow.websockets.jsr.handshake.HandshakeUtil.checkOrigin(HandshakeUtil.java:54)
	at io.undertow.websockets.jsr.handshake.Handshake.matches(Handshake.java:283)
	at io.undertow.websockets.jsr.JsrWebSocketFilter.doFilter(JsrWebSocketFilter.java:109)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
	at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:65)
	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
	at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:270)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:59)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:116)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:113)
	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1$1.call(UndertowDeploymentRecorder.java:476)

It seems that the service provider for javax.websocket.server.ServerEndpointConfig$Configurator is not available.

If I hack the following build step into the undertow-websockets extension, the problem seems fixed:

@BuildStep
ServiceProviderBuildItem registerConfiguratorServiceProvider() {
    return new ServiceProviderBuildItem(ServerEndpointConfig.Configurator.class.getName(),
            DefaultContainerConfigurator.class.getName());
}

I tweaked the websockets quickstart to reproduce the problem here:

https://github.com/jamesnetherton/quarkus-quickstarts/tree/ws-test/websockets-quickstart

@jamesnetherton jamesnetherton added the kind/bug Something isn't working label Mar 2, 2020
@gsmet gsmet added this to the 1.3.0 milestone Mar 2, 2020
@gsmet
Copy link
Member

gsmet commented Mar 3, 2020

/cc @stuartwdouglas have you seen that one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants