OpenFire post-deployment error: Java.lang.IllegalArgumentException:interface xx is isn't visible from class loader

Source: Internet
Author: User

The exception is the class loader that loaded the interface when the agent was created and the inconsistencies that were passed in when it was created.

In the local eclipse do openfire two times development, local run Yes, deployed to the server after the report exception:

Java.lang.IllegalArgumentException:interface xx is isn't visible from class loader.

According to the exception information, it is known that the dynamic Agent error. But there was no such exception occurred before deployment.

Analysis from the log, you can find the place to throw the exception is:

Class<?> java.lang.reflect.Proxy.getProxyClass0 (ClassLoader loader, class<?> .... interfaces); Due to the inability of breakpoint analysis on the server and the inability to modify the JDK add log, by copying the key code to your own code to start throwing an exception at the print log, you find:
            NULL ;             Try {                false, loader);             Catch (ClassNotFoundException e) {            }            if (interfaceclass! = Interfaces[i]) {                 thrownew  illegalargumentexception (                    + "isn't visible from class loader" );            }        
Interfaceclass is a null value.

Then compare the previous development code:
Before:  Public Rpcgameaction gameaction = (rpcgameaction) Container            . Createremoteservice (rpcgameaction. class, "Gamecenter"); now: public rpcgameaction getgameaction (String prefix)    {                 return (rpcgameaction) Container                . Createremoteservice (rpcgameaction. class , prefix);    }

The code to get the ClassLoader in the code that creates the agent is:
ClassLoader loader = Thread.CurrentThread (). Getcontextclassloader ();

The former will be created at initialization time, and the latter will be created according to the classloader of the runtime, while the ClassLoader of the OpenFire loading plug-in is inconsistent with the run, causing the creation to fail.

The solution can be: rpcgameaction this agent with the plug-in startup and created into memory;

Place the jar package where the interface is located. The/openfire/lib directory.

 

OpenFire post-deployment error: Java.lang.IllegalArgumentException:interface xx is isn't visible from class loader

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.