-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Cannot use javax.websocket client from within web app #4401
Comments
Currently the module exposes:
So while ideally I'd like to have no org.eclipse classes exposed, obviously we are exposing some. So perhaps exposing If we really have to expose more classes, then my follow up question is, should that be done automatically as part of enabling websocket server, or should there be another module that needs to be enabled that exposes the client. We have had it before where apps that just used the server started a lot of unnecessary client mechanisms... I guess your experience shows that is not happening, but we still might be best to have a separate module to avoid accidentally doing that in future? Thoughts? |
@gregw the class loader that initiates the load is the web app class loader. I'm fine with a new |
@lachlan-roberts to test this properly, we need a WAR / WebAppContext setup, where a Servlet within it uses the |
But if the class is requested from a class that was already loaded by the container, it should be able to bypass the context classloader? |
The class is requested by |
We can just |
@sbordet I cannot reproduce this issue even with just a webapp using jetty-home. |
- WebSocketCoreSession now updates the context classloader before invoking application code. - JavaxWebSocketConfiguration now protectAndExposes JavaxWebSocketClientContainerProvider so it can be discovered by the ServiceLoader in a webapp.
This has been fixed and is tested in jetty since PR #4435, we now |
Jetty version
10
Description
CometD 6 has a test where it creates a war and uses
WebAppContext
to deploy it.The web app in the war tries to create a new JSR client container:
This fails because the implementation class,
org.eclipse.jetty.websocket.javax.client.JavaxWebSocketClientContainerProvider
, is hidden to the web application because it's a server class.Changing
JavaxWebSocketConfiguration
toprotectAndExpose("org.eclipse.jetty.websocket.javax.client.")
solves the issue.This does not happen in
jetty-9.4.x
because by defaultorg.eclipse.jetty.websocket.
is protected and exposed to web application.I don't want to put the Jetty JSR WebSocket implementation in the war's
WEB-INF/lib
because when I deploy it to another Servlet Container I expect it to be provided by the Container.A test case that creates a war must be written for this case, to enforce the web app classloading rules.
@gregw do you think it's ok to open up that package?
The text was updated successfully, but these errors were encountered: