robotframework/jrobotremoteserver

ProtocolError for localhost:8270/RPC2: 404 No library mapped to /RPC2

alejandro-serrano opened this issue · 2 comments

Hi,

I have created a RF JavaLibrary using jrobotremoteserver-standalone-2.0.jar. Everything is working fine under version 2.0. I have upgraded the jar to jrobotremoteserver-3.0-standalone.jar and I'm having the issue mentioned in the Title of this question.

// Programmatic Usage with version 2.0
RemoteServer.configureLogging();
RemoteServer server = new RemoteServer();
server.addLibrary(MyJavaLibrary.class, 8270);
server.start();

// I have changed it to:
RemoteServer.configureLogging();
RemoteServer server = new RemoteServer();
server.putLibrary("/", new MyJavaLibrary());
server.setPort(8270);
server.start();

Whenever I try the new version, I get the following error in RIDE:

Calling dynamic method 'get_keyword_names' failed: Connecting remote server at http://localhost:8270 failed: ProtocolError for localhost:8270/RPC2: 404 No library mapped to /RPC2

However, if you open a browser pointing to http://localhost:8270/
I'm getting response from the server:
jrobotremoteserver serving:
Path Library
/ JavaTISmartViewCELibrary

In order to avoid the error message I changed the following line in my code:
server.putLibrary("/", new MyJavaLibrary());
// to
server.putLibrary("/RPC2", new MyJavaLibrary());

I would like to know what is causing the error when I use this value "/" as path argument. Is it an error on the new jrobotremoteserver version or in the Remote.py client?

Thanks,
Alejandro Serrano.

Greetings @alejandro-serrano !
The short answer is that if you want to use the library mapped to /, you need to have a / at the end of your uri parameter to Remote. For example, change:
Library Remote http://localhost:8270
to
Library Remote http://localhost:8270/
Explanation...
From the documentation for xmlrpclib's ServerProxy:
If the target part and the slash preceding it are both omitted,
"/RPC2" is assumed.

In 2.0, the path was ignored and so it was working. In 3.0, the path matters. The examples in the user guide for Robot Framework all lack the trailing / and there is no note that /RPC2 will be used unfortunately.

I will consider adding this information to the FAQ and/or trying to get the RF team to put a note in the user guide.

Happy remoting!

Very quick fix. It is working fine now.

Thank you very much!
Alejandro.