[SOLVED] Java error: Can not initialize cryptographic mechanism

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
petero
Posts: 3
Joined: 11 Aug 2017, 10:03

[SOLVED] Java error: Can not initialize cryptographic mechanism

Post by petero »

Small context:

I have a fully updated Synology RS814, it runs the latest version 6 of the os. I have from the first time filebot was available as a package had it installed, but realized sometime recently that it was no longer working for Movies (for TV shows it has been running just fine) (the cause was the change of files on the server to github). I deleted the old synology repository and created the new one described in the "installing filbot on synology". This caused package manager to find an update to FileBot.

However the latest version of FileBot did not work with my groovy script (it had unpackaging of rar files and other stuff that I actually never had the need for). After a summer time cleaning I have the following script:

Code: Select all

// PERSONALIZED SETTINGS
def episodeDir    = '''/volume1/download/tv''' as File
def episodeFormat = '''/volume1/video/Series/{n}/{"Season ${s.pad(2)}"}/{n} - {s00e00} - {t}'''
def movieDir      = '''/volume1/download/movies''' as File
def movieFormat   = '''/volume1/video/Movies/{genres[0]}/{n} ({y})/{n} ({y}){" CD$pi"}'''

// XBMC ON LOCAL MACHINE
def xbmc = ['localhost'] // (use [] to not notify any XBMC instances about updates)

/*
 * Fetch subtitles and sort into folders
 */
episodeDir.getFolders{ it.hasFile{ it.isVideo() } }.each{ dir ->
        println "Processing $dir"
        def files = dir.listFiles{ it.isVideo() }

        // sort episodes / subtitles
        rename(file:files, db:'TheTVDB', format:episodeFormat, strict:false, conflict:'override')
}

movieDir.getFolders{ it.hasFile{ it.isVideo() } }.each{ dir ->
        println "Processing $dir"
        def files = dir.listFiles{ it.isVideo() }

        // sort movies / subtitles
        rename(file:files, db:'TheMovieDB', format:movieFormat)
}
Which resulted in the following error:

Code: Select all

admin@xxxxxxx:/volume1/@scripts/videoclean$ filebot -script clean.groovy
Processing /volume1/download/movies/@eaDir
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/volume1/download/movies/@eaDir/Blade Runner (1982) Final Cut 1080p BluRay.x264 SUJAIDR.mp4]
null
java.lang.ExceptionInInitializerError
        at net.filebot.web.WebRequest.fetch(WebRequest.java:140)
        ...........
Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
        ... 32 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        ... 32 more 
Failure (°_°)
Full error: https://pastebin.com/SyN6gpgD

However during the writing of this post in order to check everything, I removed these lines (because I have no xbmc running anywhere)

Code: Select all

// XBMC ON LOCAL MACHINE
def xbmc = ['localhost'] // (use [] to not notify any XBMC instances about updates)
Which gave a new error, so I tried adding them back, which did not change the error back, which is now:

Code: Select all

filebot -script clean.groovy
0
java.lang.ArrayIndexOutOfBoundsException: 0
Full error: https://pastebin.com/RUhynuVR

I have tried installing the unofficial java from the filebot respository, and I have tried installing Java8 from the official synology repository, no change:

Output from filebot -script fn:sysinfo is now also an error:

Code: Select all

 filebot -script fn:sysinfo
null
java.lang.ExceptionInInitializerError
        at net.filebot.web.WebRequest.fetch(WebRequest.java:140)
        at net.filebot.CachedResource.lambda$fetchIfModified$9(CachedResource.java:215)
        at net.filebot.CachedResource$$Lambda$20/22366245.fetch(Unknown Source)
        at net.filebot.CachedResource.lambda$null$0(CachedResource.java:87)
        at net.filebot.CachedResource$$Lambda$25/7915312.call(Unknown Source)
        at net.filebot.CachedResource.retry(CachedResource.java:121)
        at net.filebot.CachedResource.lambda$get$1(CachedResource.java:87)
        at net.filebot.CachedResource$$Lambda$24/12643819.apply(Unknown Source)
        at net.filebot.Cache.computeIf(Cache.java:90)
        at net.filebot.CachedResource.get(CachedResource.java:82)
        at net.filebot.MemoizedResource.get(Resource.java:36)
        at net.filebot.cli.ScriptBundle.getScript(ScriptBundle.java:32)
        at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:74)
        at net.filebot.cli.ArgumentProcessor.runScript(ArgumentProcessor.java:119)
        at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:29)
        at net.filebot.Main.main(Main.java:115)
Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
        ... 16 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        ... 16 more

Failure (°_°)
Additionally I have tried:
  • Uninstalling filebot and java in all different combinations
    Reboot (duh)
    Searching for this error on filebot forums
    Searching for the java error in general
But I cannot seem to find a solution.

Any help appreciated.
Last edited by petero on 11 Aug 2017, 11:03, edited 1 time in total.
petero
Posts: 3
Joined: 11 Aug 2017, 10:03

Re: Java error: Can not initialize cryptographic mechanism

Post by petero »

The new error message has led me to the generel Synology version 6 thread. Was searching for the wrong error message on the forums.
petero
Posts: 3
Joined: 11 Aug 2017, 10:03

Re: Java error: Can not initialize cryptographic mechanism

Post by petero »

After a little more research into the javas I can tell that the problem was too many javas

Even though all Java versions were uninstalled in the package manager there was still folders in /volume1/@appstore/ with variations of the java name (java, Java8, oracle-java).

Steps to fix:
  1. First remove FileBot,
  2. Remove ALL java folders in /volume1/@appstore/ (after making sure that ALL java versions are removed in the package manager)
    (and if there should be a folder name FileBot after you removed it in package manager, remove it too now)
  3. Then install the "Unofficial Java" from FileBot repository. (I keep looking under "J" for it, and keep thinking was it removed from the repository, maybe some day I will learn)
  4. Then install FileBot again.
  5. Now it works.
Post Reply