Clojure problem with rmi classpath

I am trying to use clojure to implement a "plugin" for some vendor of the supplied software.

Here is a small guide to the vendor-supplied software. This expects me to implement a specific interface, and then put the jar file containing this implementation in a directory on my server. Then, when the client starts the software, my implemented class receives "sent" for the client from the server via RMI, and then my implementation of the interface works on the client. The client does not have a jar file (or clojure jar file) in it classpath. Only the server has these jar files. RMI seems smart enough to load all the necessary dependencies.

I have successfully created a very simple implementation in clojure and it works. The problem is that I would like to be able to update my client implementation on the fly. I have included a repeater in my class and I can successfully connect with this. To be clear, the relay is running on the server, and I can connect to repl to get the prompt "clojure.core =>". However, the replica seems to be pretty crippled. If I type (+ 1 1), I get the following error: "java.lang.ClassNotFoundException: clojure.lang.Numbers". If you type (str "kent") I get "java.lang.NoClassDefFoundError: clojure / lang / AFunction". Most of the things I introduced produce something similar. however, making simple def, such as (def x 3) and x, is defined so that REPL seems to work in a way.

It seems that this may be a problem with the classpath, but I'm not sure why my "compiled" code running on the client does not have a class path problem, while repl working on the same client cannot find core classes.

Any ideas?

Thanks. Kent.

+3
source share
1 answer

First of all, is it possible to distribute clojure.jar as part of your RMI client? Based on your description of the vendor software, I assume the answer is no.

Secondly, are the contents of clojure.jar and your RMI object in the same jar file on the server, or both are in their own jar files?

, . Clojure , Clojure . IIRC loadload, . , , RMI RMI . , , .

, ...

-

+2

Source: https://habr.com/ru/post/1723058/


All Articles