You are not logged in.

#1 2024-08-01 17:22:22

RLado
Member
Registered: 2024-08-01
Posts: 3

[SOLVED] pdftk package is missing dependencies

pdftk (version: 3.3.3-3) errors out when trying to add a password to a file. I have tried reinstalling both bcprov and java-commons-lang but I keep getting the same error. I think this might be a dependency issue for this package. Does anybody know how to solve this problem? Should I report it as a bug?

When running this command I get the following error:
> pdftk sample.pdf output sample_w_password.pdf user_pw PROMPT

Please enter the user password to use on the output PDF.
   It can be empty, or have a maximum of 32 characters:
EXAMPLE_PASSWORD
Error: could not load a required library for this operation.
java.lang.NoClassDefFoundError: org/bouncycastle/crypto/BlockCipher
Make sure that bcprov and commons-lang3 are installed and included in the
classpath. See also https://gitlab.com/pdftk-java/pdftk/issues/2.
   No output created.

Last edited by RLado (2024-08-03 14:58:41)

Offline

#2 2024-08-01 18:04:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] pdftk package is missing dependencies

Did you make sure bcprov and commons-lang3 are included in the classpath?  Did you follow that link?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2024-08-01 20:14:01

RLado
Member
Registered: 2024-08-01
Posts: 3

Re: [SOLVED] pdftk package is missing dependencies

I have not, I am not familiar with Java. But I am not building from source, do I have to set a classpath anyway? Shouldn't the package configure that for me?

Offline

#4 2024-08-02 02:43:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] pdftk package is missing dependencies

I just tried pdftk - I've never used it before but I can confirm the error and can also confirm that the class paths appear to be properly exported in the pdftk script.

So I went looking for the BlockCipher class specifically and found this:

$ ls -l /usr/share/java/bcprov/
total 7472
-rw-r--r--    1 root     root       7647387 Jul 11 07:08 bcprov-jdk18on-17801.jar
lrwxrwxrwx    1 root     root            20 Jul 11 07:08 bcprov.jar -> bcprov-jdk18on-*.jar

That bcprov.jar is not only a "broken" link, it's completely invalid and is almost certainly meant to point to the other jar file.  I suspect the link name was improperly quoted in a build or install script resulting in the broken link.

I manually fixed the symlink on my system, then retried the pdftk command to add a password to a pdf and it seems to have been successful (no error).  So this looks like a bug in bcprov - and I traced it to line 45 of the PKGBUILD.  That's not quoting failure, but an improper way to make a symlink as it was not in the proper directory: so the glob didn't match anything and became the literal link target.

You can temporarily fix the link yourself to get your system working properly.  But you should probably report this as a bug to get it fixed in the package.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2024-08-02 05:36:24

RLado
Member
Registered: 2024-08-01
Posts: 3

Re: [SOLVED] pdftk package is missing dependencies

Thank you! Fixing the symlink resolved the issue for me as well. I will now report the bug.

Offline

#6 2024-08-06 09:26:21

dau5SX
Member
Registered: 2024-08-06
Posts: 1

Re: [SOLVED] pdftk package is missing dependencies

Hello,

@Trilby: thank you!

Best regards,

Offline

Board footer

Powered by FluxBB