Resteasy is not able to load the proxy interface, ERROR: java.lang.IllegalArgumentException: interface RESTServiceInterface is not visible from class loader

Solution Verified - Updated -

Issue

  • The Resteasy client fails to build a dynamic proxy using an annotated interface and throws the below ERROR and traces:

    12:38:36,269 ERROR [:] [xx.xx.xx.xx] (default task-1) java.lang.IllegalArgumentException: interface xx.xx.xx.RESTServiceInterface is not visible from class loader: java.lang.IllegalArgumentException: interface xx.xx.xx.RESTServiceInterface is not visible from class loader
    at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581) [rt.jar:1.8.0_162]
    at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557) [rt.jar:1.8.0_162]
    at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230) [rt.jar:1.8.0_162]
    at java.lang.reflect.WeakCache.get(WeakCache.java:127) [rt.jar:1.8.0_162]
    at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419) [rt.jar:1.8.0_162]
    at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719) [rt.jar:1.8.0_162]
    at org.jboss.resteasy.client.jaxrs.ProxyBuilder.proxy(ProxyBuilder.java:85) [resteasy-client-3.6.1.SP2-redhat-00001.jar:3.6.1.SP2-redhat-00001]
    at org.jboss.resteasy.client.jaxrs.ProxyBuilder.build(ProxyBuilder.java:152) [resteasy-client-3.6.1.SP2-redhat-00001.jar:3.6.1.SP2-redhat-00001]
    at org.jboss.resteasy.client.jaxrs.internal.ClientWebTarget.proxy(ClientWebTarget.java:93) [resteasy-client-3.6.1.SP2-redhat-00001.jar:3.6.1.SP2-redhat-00001]
    ...
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.2
  • A servlet is providing a webservice. The servlet is secured using a custom Elytron realm amd HTTP basic authentication. The custom Elytron realm (provided as JBoss module) is calling an external REST service (identity store) during authentication using a Resteasy client

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content