ClassNotFoundException caused by AccessControlException when calling an EJB from a Java Web Start application

Solution Verified - Updated -

Environment

  • JBoss Enterprise Application Platform (EAP)
  • JNLP (Web Start) application

Issue

  • When calling an EJB from a Java Web Start application, a ClassNotFoundException caused by an AccessControlException is thrown:

    java.lang.reflect.UndeclaredThrowableException
    ...
    Caused by: java.lang.ClassNotFoundException: access to class loader denied
        at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
        ...
        at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
        ... 14 more
    Caused by: java.security.AccessControlException: access denied (java.net.SocketPermission 10.1.2.3:8383 connect,resolve)
        at java.security.AccessControlContext.checkPermission(Unknown Source)
        at java.security.AccessController.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkPermission(Unknown Source)
        at sun.rmi.server.LoaderHandler$Loader.checkPermissions(Unknown Source)
        at sun.rmi.server.LoaderHandler$Loader.access$000(Unknown Source)
    

Resolution

This error occurrs because the client does not have all the necessary classes it needs.
It tries to load the classes from the server using RMI classloading, but the current security permissions on the client do not allow the connection.

To correct the issue, either:
1. Include all client classes needed in the application's jnlp
2. Configure security in the JNLP to allow access to open the port

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.