exceptionfactory commented on a change in pull request #4918:
URL: https://github.com/apache/nifi/pull/4918#discussion_r600953627



##########
File path: 
nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/main/java/org/apache/nifi/websocket/jetty/JettyWebSocketServer.java
##########
@@ -213,6 +214,14 @@ public void configure(WebSocketServletFactory 
webSocketServletFactory) {
             webSocketServletFactory.setCreator(this);
         }
 
+        @Override
+        public void init() throws ServletException {
+            // Set Component ClassLoader as Thread Context ClassLoader so that 
jetty-server classes are available to WebSocketServletFactory.Loader
+            final ClassLoader componentClassLoader = 
getClass().getClassLoader();
+            Thread.currentThread().setContextClassLoader(componentClassLoader);
+            super.init();
+        }

Review comment:
       Thanks for the feedback @turcsanyip!  That makes sense, and provides a 
cleaner solution.  I confirmed that setting the `ServletContextLoader` 
`ClassLoader` works at runtime.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to