Page 1 of 1

Class not whitelisted for RMI

PostPosted: Fri Feb 03, 2017 2:49 am
by kwpsd
Servoy 8.1.1
JRE 1.8.0_121
Jasper Plugin 6.0.0
Smart Client

We installed Servoy 8.1.1 (server only) on a customer's server and imported a solution. When we attempt to print a Jasper report within the solution, we get the following error:

not_rmi_whitelisted.png
not_rmi_whitelisted.png (10.75 KiB) Viewed 11688 times


We found this item on how to whitelist .jar files using the RMI but do not believe the 'net.sf.jasperreports.engine.JasperPrint;' pertains to the whitelist (it's not a .jar file...at least, we could not find it):

http://forum.servoy.com/viewtopic.php?f=16&t=21087

Does anyone know what is causing the error and how to fix it?

Thanks!

Re: Class not whitelisted for RMI

PostPosted: Fri Feb 03, 2017 2:59 am
by sbutler
I don't use the smart client much any more, so I haven't experienced this, but the whitelisting using the rmi-whitelist.jar from Johan's post looks like its referencing packages, not jars. A jar is just a zip of a folder structure with some extras, so in this example, it looks like you probably want to add "net.sf.jasperreports." to your whitelist (note the period at the end). Then all the classes under those packages/folders in the jar will be whitelisted.

Just a guess, I haven't tried it before :)

PS. If you unzip the jasperreports-X.X.X.jar, you'll see that folder structure and class in there.

Re: Class not whitelisted for RMI

PostPosted: Fri Feb 03, 2017 9:50 pm
by kwpsd
Ah, thank you Scott...now I understand what is needed.

I found the RMI white list here:

Code: Select all
C:\Servoy\application_server\lib\rmi-whitelist.jar


Within the .jar is the following path:

Code: Select all
\com\servoy\rmi\whitelist\WhitelistingRMIClassLoaderSpi.class


My understanding is this:

To modify the .class file, I would have to extract and decompile the file, add the "net.sf.jasperreports." path, recompile the code back into a class file, then add it back to the .jar file. Is there an alternate way to add the pathname (like a simple text edit), and, if so, would someone be willing to provide an example? My Java knowledge is rather limited.

Thanks!

Re: Class not whitelisted for RMI

PostPosted: Fri Feb 03, 2017 10:38 pm
by sbutler
No need to decompile. Sorry I confused you. I was just explaining how Jars work, with the classes and folder structure in them.

In Johan's forum post here: viewtopic.php?f=16&t=21087 he describes how to use the rmi-whitelist.jar to add additional classes to the whitelist.

In the JAVA_OPTS, there is a property set, "rmi.whitelist.config". You need to set it to a colon separated list of packages you want to white list. for example,
Code: Select all
rmi.whitelist.config=com.servoy.:com.sebster.:net.sf.jasperreports.

(notice I added net.sf.jasperreports.)

How you set that depends on how you launch servoy. See Johan's post. It would be in the servoy startup script .sh/.bat or in the service wrapper.

Re: Class not whitelisted for RMI

PostPosted: Sat Feb 04, 2017 9:59 pm
by kwpsd
Thanks again, Scott!

I saw Johan's post but was confused by it...I still do not know what JAVA_OPTS is. I presume it is a generic term for Java options, wherever they may exist, since I could not find anything by that name. However, I did find what I needed to modify and want to post the information here for others who may come across this situation.

If you are running Servoy server as a Windows service and need to add a package reference to the RMI white list, you need to modify the service wrapper configuration file (wrapper.conf). This file is located in the following path:

C:\Servoy\application_server\service\wrapper.conf

Open wrapper.conf in a text editor and locate the section called Java Additional Parameters.

Code: Select all
# Java Additional Parameters
wrapper.java.additional.1=-Djava.awt.headless=true
wrapper.java.additional.2=-Duser.dir="C:\Servoy\application_server"
wrapper.java.additional.3=-Djava.io.tmpdir="C:\Servoy\application_server\server\work"
wrapper.java.additional.4=-XX:MaxPermSize=128m
wrapper.java.additional.5=-Drmi.whitelist.config=com.servoy.:com.sebster.:net.sf.jasperreports.

Within this section, locate the line starting with 'wrapper.java.additional.x=-Drmi.whitelist.config='. Append each package reference to this line separating them by a colon (:) character. Do not forget to end the package pathname with a period (.). Below is an example:

adding_packages_to_rmi_whitelist.png
adding_packages_to_rmi_whitelist.png (11.58 KiB) Viewed 11626 times


I hope this helps!

@Servoy: I am surprisred the 'net.sf.jasperreports.' pathname was not included in the RMI whitelist by default.

Thanks

PostPosted: Thu Feb 23, 2017 1:54 pm
by Bernd.N
Thanks a lot for this, I had exactly the same problem when installing new Servoy AppServers today with the latest Java Update.
Now it works like a charm again.

Re: Class not whitelisted for RMI

PostPosted: Thu Feb 23, 2017 2:43 pm
by lwjwillemsen
@Servoy: I am surprisred the 'net.sf.jasperreports.' pathname was not included in the RMI whitelist by default.

Re: Class not whitelisted for RMI

PostPosted: Thu Feb 23, 2017 3:05 pm
by Bernd.N
That would be a good idea, Lambert.
Would you like to write a ticket to let this improve for the next version?

Re: Class not whitelisted for RMI

PostPosted: Thu Feb 23, 2017 3:54 pm
by lwjwillemsen
Hi Bernd,

Sorry, I am kind of busy right now, maybe would you?

Re: Class not whitelisted for RMI

PostPosted: Thu Feb 23, 2017 4:12 pm
by Bernd.N