Errors when trying to use Rest Resource Javascript


(Nic Hubbard) #1

I am using the Rest Resource Javascript and it is not displaying anything. Logs are showing this error:

21:05:18 - 05 Oct
User: Root User (12)
Level: Matrix Notice
(/packages/web_services/rest/page_templates/page_rest_resource_js/page_rest_resource_js.inc:190) - Page_REST_Resource_JS (#2416) /usr/bin/js: error while loading shared libraries: libplds4.so: cannot open shared object file: No such file or directory

I have the external tool installed as well as the correct Javascript entered (which I have used on another site successfully). Googling that error really gets me nowhere.

 

Any ideas?


(David Schoen) #2

That error is a library loading issue within the JS binary itself, so you need to look closer there first.

 

First thing to try would be running 

/usr/bin/js

directly as the web server user on the console. If you get the same error you need to look in to resolving it there (either configuring LD_LIBRARY_PATH correctly or installing the missing package).

 

If you don't get the error there, it's likely there's some environmental difference when Matrix is calling out to it and it gets slightly harder to test out.


(Nic Hubbard) #3

That error is a library loading issue within the JS binary itself, so you need to look closer there first.

 

First thing to try would be running 

/usr/bin/js

directly as the web server user on the console. If you get the same error you need to look in to resolving it there (either configuring LD_LIBRARY_PATH correctly or installing the missing package).

 

If you don't get the error there, it's likely there's some environmental difference when Matrix is calling out to it and it gets slightly harder to test out.

 

I am getting the same error in the console. No idea where LB_LIBRARY_PATH is, or how I would know what the missing package is.

 

Running in Debian 7. 


(David Schoen) #4

So (assuming this JS binary came from Debian) it's a problem with the way Debian have packaged it.

 

The package that's probably missing would be NSPR: https://packages.debian.org/wheezy/libnspr4

 

I'm guessing you're using Spider Monkey for JS (based on that file only showing up in NSPR and XUL Runner)?

 

If you install libnspr4 (or it's already installed) and you're still getting the error, it's sometimes possible to configure LD_LIBRARY_PATH to encourage the loader to look where you want it to (similar to updating PATH to encourage the shell to look for binaries where you want), see: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

 

You may end up having to create a script with something like:

#!/bin/sh -e

export LD_LIBRARY_PATH="%where the library lives%"
/usr/bin/env js “$@”


(Nic Hubbard) #5

No, I actually found the binary from the spider monkey site. (This is sort of an issue with the Matrix Manuals, it doesn't specify where to get the binary from). Should I have gotten it elsewhere?


(David Schoen) #6

We only use EL (Enterprise Linux, e.g RHEL, Scientific Linux or CentOS) type distros at the moment, but for Debian I think you should be able to install Spidermonkey like so:

apt-get install libmozjs-24-bin

I don't have a true Debian box handy to test this on right now though, but on Ubuntu (which is using the Debian derived packages) that pulls in the binary and dependencies correctly.

 

The path it installs to is /usr/bin/js24 , so you'll need to try that instead of /usr/bin/js.

 

p.s I'll leave the issues with the Matrix Manuals up to Bart as that's completely out of my court.


(Nic Hubbard) #7

Had to do:

apt-get install libmozjs-dev

But that fixed it! Thanks for helping me out. Really appreciate it!