(Possibly OT?) ClassNotFound strange issue

  • I am not sure if this is because of RW or because I hit some obscure (for me!) Java conundrum. I am facing some Class Not Found exception I cannot explain. It arose in a rather convoluted scenario; this is the simplest case I can arrive at still exhibiting the issue.


    Context: 2 plug-ins:
    - a Back-End plug-in defining a class (ClassA) to be used by other plug-ins: it is made of two source files: the main plug-in file and the additional ClassA source file
    - a Front-End plug-in using ClassA


    All tests have been done with a local dedicated server running on the same machine as the client (the client connects via local IP). I have made sure that the Front-End plug-in is loaded before than the Back-End, in case this matters, to be sure to have the most adverse condition (the consumer plug-in is loaded before the provider plug-in is available).


    Back-End Plug-in main file (TestBackend.java; minimum possible code!):



    Back-End additional class file (ClassA.java): simply inherits from GuiPanel, adds a field and a simple get/set method pair:



    Front-End Plug-in source file (TestFrontend.java):


    (note: commenting out the two last statements is intentional: see below)


    With this sources, both plug-ins are loaded correctly and the onCommand method is executed correctly. This means that the definition of com.vistamaresoft.testbackend.ClassA is found and its methods located. So far, so good.


    As soon as the two last statements are uncommented (with the respective import at the top), RW terminates at start-up with the error:
    java.lang.ClassNotFoundException: com.vistamaresoft.testbackend.ClassA (well before line 31 is executed). The simple presence of a classA parameter in line 31 is enough for something failing in the class loading mechanism.


    I tried several cases and the failure always happens when a plug-in contains a statement where an instance of a class defined in another plug-in (another package) is passed as a parameter to a method call. The called method can be a plug-in method or most API methods, there seems to be no difference.


    Some API methods seem not affected, for instance event.getPlayer().setAttribute("test", classA); in the above code does not create problems.


    Can anyone explain what is happening?


    Thanks!

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!