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