Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Jetty WebSockets ClassLoading Issue


I have an issue using Jetty and WebSockets related to class loading.  I have a class set up as a web service endpoint using java annotations.  In the onOpen() method.  I create an instance of the MyClient class.  The MyClient class uses the Apache Commons Lang EventListenerSupport which requires passing an interface class object in.  The interface is “MyInterface”.  When constructing the MyClient object,  I get an exception saying the class can’t be loaded because it is not visible from the class loader.  The MyClient and the MyInterace classes are both public, both in the same package, and both in the same jar file.  I am very confused as to why the class loader can find the MyClient class but not the MyInterface class.

The Commons Lang jar file is also in the WEB-INF/lib directory as well.  I have listed the classes and the exception I am getting.  Any ideas on what the problem might be, or how to debug it would be helpful.

## My Client Class

package com.example;

public class MyClient {

    private EventListenerSupport<MyInterface> listeners;

    public MyClient() {

         this.listeners = EventListenerSupport.create(MyInterface.class);



## MyInterface

package com.example;

public interface MyInterface {

    void onClientConnected();


java.lang.IllegalArgumentException: interface com.example.MyInterface is not visible from class loader

at java.lang.reflect.Proxy$ProxyClassFactory.apply(

at java.lang.reflect.Proxy$ProxyClassFactory.apply(

at java.lang.reflect.WeakCache$Factory.get(

at java.lang.reflect.WeakCache.get(

at java.lang.reflect.Proxy.getProxyClass0(

at java.lang.reflect.Proxy.newProxyInstance(

at org.apache.commons.lang3.event.EventListenerSupport.createProxy(

at org.apache.commons.lang3.event.EventListenerSupport.initializeTransientFields(

at org.apache.commons.lang3.event.EventListenerSupport.<init>(

at org.apache.commons.lang3.event.EventListenerSupport.<init>(

at org.apache.commons.lang3.event.EventListenerSupport.create(

at com.example.MyClient.<init>(

at com.example.WebSocketSessionManager.onOpen(

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(

at sun.reflect.DelegatingMethodAccessorImpl.invoke(

at java.lang.reflect.Method.invoke(



at org.eclipse.jetty.websocket.jsr356.annotations.JsrEvents.callOpen(

at org.eclipse.jetty.websocket.jsr356.endpoints.JsrAnnotatedEventDriver.onConnect(


at org.eclipse.jetty.websocket.jsr356.endpoints.AbstractJsrEventDriver.openSession(


at org.eclipse.jetty.websocket.server.WebSocketServerConnection.onOpen(

at org.eclipse.jetty.server.HttpConnection.completed(

at org.eclipse.jetty.server.HttpChannel.handle(

at org.eclipse.jetty.server.HttpConnection.onFillable(


at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(

at org.eclipse.jetty.util.thread.QueuedThreadPool$


Michael S. MacFadden
Technical Director and Chief Engineer
4250 Pacific Highway, Suite 211
San Diego, CA 92110
Office: (619) 758-9900
Cell: (585) 259-0529

CONFIDENTIALITY NOTICE: This e-mail and any attachments are intended solely for the use of the individual or entity to whom it is addressed. It may contain information that is privileged, confidential and exempt, or protected from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any review, use, disclosure, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately and destroy all copies and attachments

Back to the top