Community
Participate
Working Groups
With version 5.6 of jGit we now get the error java.lang.NoClassDefFoundError: org/bouncycastle/util/io/TeeOutputStream at org.eclipse.jgit.hooks.Hooks.prePush(Hooks.java:183) ... Caused by: java.lang.ClassNotFoundException: org.bouncycastle.util.io.TeeOutputStream The problem is caused by the change in the doRun-method of GitHook. Version 5.5 worked well. We are using your jgit in a standalone-app - inside eclipse-ide it works fine. Would be nice if you did not need extra dependencies.
org.eclipse.jgit:org.eclipse.jgit depends on Bouncycastle libraries since 5.3.0 when support for signed commits was introduced [1]. Feel free to contribute an alternative implementation of a TeeOutputStream which doesn't introduce another dependency. [1] https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/137e91a4654b4f516d1f82885c669e14473dbfd6
... up to now this dependency did not hit us. Maybe it will in future - depending on your policy - so I will have to update our apps classpath (or replace our dependency on jgit). For me it's ok to close this 'bug'. Anyway - here's a simple teeoutputstream - feel free to use it: import java.io.IOException; import java.io.OutputStream; import java.util.Arrays; public class TeeOutputStream extends OutputStream { private final OutputStream[] osa; public TeeOutputStream(final OutputStream... streams) { super(); osa = Arrays.copyOf(streams, streams.length); } @Override public void write(final int b) throws IOException { for (final OutputStream os : osa) os.write(b); } @Override public void write(final byte[] b) throws IOException { for (final OutputStream os : osa) os.write(b); } @Override public void write(final byte[] b, final int off, final int len) throws IOException { for (final OutputStream os : osa) os.write(b, off, len); } @Override public void flush() throws IOException { for (final OutputStream os : osa) os.flush(); } @Override public void close() throws IOException { for (final OutputStream os : osa) os.close(); } }
I just scanned the core-jgit-sources for 'bouncycastle': Looks like there is only one other class that uses such a package (outside the jgit-bouncycastle-classes): WalkEncryption. And there it's only one class in use: org.bouncycastle.util.encoders.Hex Maybe with a little more re-thinking you could 'hide' this dependency (at least in the core-jar). Here my search-results for bouncycastle: .\org.eclipse.jgit.source_5.6.0.201912101111-r.jar ! org\eclipse\jgit\transport\WalkEncryption.java 70: import org.bouncycastle.util.encoders.Hex; .\org.eclipse.jgit.source_5.6.0.201912101111-r.jar ! org\eclipse\jgit\hooks\GitHook.java 53: import org.bouncycastle.util.io.TeeOutputStream; .\org.eclipse.jgit.source_5.6.0.201912101111-r.jar ! org\eclipse\jgit\lib\internal\BouncyCastleGpgKeyPassphrasePrompt.java 49: import org.bouncycastle.openpgp.PGPException; 50: import org.bouncycastle.util.encoders.Hex; .\org.eclipse.jgit.source_5.6.0.201912101111-r.jar ! org\eclipse\jgit\lib\internal\BouncyCastleGpgKey.java 47: import org.bouncycastle.openpgp.PGPSecretKey; .\org.eclipse.jgit.source_5.6.0.201912101111-r.jar ! org\eclipse\jgit\lib\internal\BouncyCastleGpgSigner.java 52: import org.bouncycastle.bcpg.ArmoredOutputStream; 53: import org.bouncycastle.bcpg.BCPGOutputStream; 54: import org.bouncycastle.bcpg.HashAlgorithmTags; 55: import org.bouncycastle.jce.provider.BouncyCastleProvider; 56: import org.bouncycastle.openpgp.PGPException; 57: import org.bouncycastle.openpgp.PGPPrivateKey; 58: import org.bouncycastle.openpgp.PGPSecretKey; 59: import org.bouncycastle.openpgp.PGPSignature; 60: import org.bouncycastle.openpgp.PGPSignatureGenerator; 61: import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder; 62: import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder; .\org.eclipse.jgit.source_5.6.0.201912101111-r.jar ! org\eclipse\jgit\lib\internal\BouncyCastleGpgKeyLocator.java 66: import org.bouncycastle.gpg.SExprParser; 67: import org.bouncycastle.gpg.keybox.BlobType; 68: import org.bouncycastle.gpg.keybox.KeyBlob; 69: import org.bouncycastle.gpg.keybox.KeyBox; 70: import org.bouncycastle.gpg.keybox.KeyInformation; 71: import org.bouncycastle.gpg.keybox.PublicKeyRingBlob; 72: import org.bouncycastle.gpg.keybox.UserID; 73: import org.bouncycastle.gpg.keybox.jcajce.JcaKeyBoxBuilder; 74: import org.bouncycastle.openpgp.PGPException; 75: import org.bouncycastle.openpgp.PGPKeyFlags; 76: import org.bouncycastle.openpgp.PGPPublicKey; 77: import org.bouncycastle.openpgp.PGPPublicKeyRing; 78: import org.bouncycastle.openpgp.PGPPublicKeyRingCollection; 79: import org.bouncycastle.openpgp.PGPSecretKey; 80: import org.bouncycastle.openpgp.PGPSecretKeyRing; 81: import org.bouncycastle.openpgp.PGPSecretKeyRingCollection; 82: import org.bouncycastle.openpgp.PGPSignature; 83: import org.bouncycastle.openpgp.PGPUtil; 84: import org.bouncycastle.openpgp.operator.PBEProtectionRemoverFactory; 85: import org.bouncycastle.openpgp.operator.PGPDigestCalculatorProvider; 86: import org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator; 87: import org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder; 88: import org.bouncycastle.openpgp.operator.jcajce.JcePBEProtectionRemoverFactory; 89: import org.bouncycastle.util.encoders.Hex;
My change addresses this https://git.eclipse.org/r/156153
New Gerrit change created: https://git.eclipse.org/r/157680
Gerrit change https://git.eclipse.org/r/157680 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=40555223594005481cba95d09b32c4f6bb5dcff3
New Gerrit change created: https://git.eclipse.org/r/161560
New Gerrit change created: https://git.eclipse.org/r/163440
New Gerrit change created: https://git.eclipse.org/r/163464
Gerrit change https://git.eclipse.org/r/163464 was merged to [master]. Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=9fb4acae133b95670b931928f0580f420dfb0bf6
Gerrit change https://git.eclipse.org/r/161560 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=77848d635b76d8294697ffaf11acf51256df2a5b
Gerrit change https://git.eclipse.org/r/163440 was merged to [master]. Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=43622bdf29aa1db663d5812583f80ab76fce4c26