alternative for FileEncodeBase64

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

bartbaas
Ebase User
Posts: 32
Joined: Wed Jun 19, 2019 9:46 am

alternative for FileEncodeBase64

#1

Postby bartbaas » Thu Apr 01, 2021 2:54 pm

Good afternoon,

In our setup, we use an FPL function FileEncodeBase64 which resides in our customfunctions folder.
%ufs%webapp\WEB-INF\classes\com\ebasetech\ufs\customfunctions

But since 5.6 we can seem to get it to function. Whenever we upload a document in our application, user gets an error about sun/misc/BASE64Encoder

And the log shows :java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
I've tried to find an appriopriate jarfile and place it in all lib folders I could find, but it seems that our jdk (12 that came with ebase 5.6) doesn't want anything to do with it.

Googling it learned me that this library is deprecated and should not be used, e.g.
https://stackoverflow.com/questions/554 ... in-eclipse

Is there an alternative to encode our files?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

Re: alternative for FileEncodeBase64

#2

Postby Jon » Wed Apr 07, 2021 12:04 pm

Could you change the script to use Javascript instead of FPL? Then you can use:

Code: Select all

var fileString = services.file.base64EncodeFile("filename");
Unfortunately you can't invoke Javascript directly from FPL so you would need to convert the entire script to Javascript, or possibly split the script.

The alternative is to change the source of the custom function to use a currently supported class, but this sounds harder to me.
0 x

bartbaas
Ebase User
Posts: 32
Joined: Wed Jun 19, 2019 9:46 am

Re: alternative for FileEncodeBase64

#3

Postby bartbaas » Thu Apr 08, 2021 2:00 pm

Hi Jon,

Thanks for your reply!
The second option is actually what I've done. I created a new class based on the current, using java.util.Base64 instead of sun.misc.Base64

But your option seems more reliable in the long run. I'll discuss this with our developers.
0 x


Who is online

Users browsing this forum: No registered users and 9 guests