Reputation: 1538
I tried to run an example code. I included in my project following libraries:
And apparently it isn't enough because I got an error:
INFO: Welcome to silvertunnel-ng.org Netlib (version 0.0.4-SNAPSHOT)
Exception in thread "main" java.lang.NoClassDefFoundError: org/spongycastle/jce/provider/BouncyCastleProvider (...) at TorTest.main(TorTest.java:16)
Caused by: java.lang.ClassNotFoundException: org.spongycastle.jce.provider.BouncyCastleProvider
Where line 16 is (you can see the whole file in the example link):
final NetSocket topSocket = NetFactory.getInstance().getNetLayerById(NetLayerIDs.TOR_OVER_TLS_OVER_TCPIP).createNetSocket(null, null, TORCHECK_NETADDRESS);
I looked for an answer how to include this BouncyCastleProvider but all I got is a hint to include bcprov-jdk15on-1.50.jar
and bcpkix-jdk15on-1.50.jar
which I did.
Does anybody know what I am missing here?
Upvotes: 3
Views: 1984
Reputation: 623
The Snapshot Version 0.0.4 of SilverTunnel-NG has been prepared to run on Android (still not working on Android) and one change needed was to use an uncrippled Version of BouncyCastle as Android has its own with the same package name. Thats why SpongyCastle has been introduced. It is just a copy of the original BouncyCastle but with a different name.
So for getting the 0.0.4-SNAPSHOT to run you need to get spongycastle.
The snapshots of SilverTunnel are also deployed to Maven Central so it is possible that maven takes care of all the dependencies.
Upvotes: 0
Reputation: 23
I had the same problem and used Augusto's answer to individually download the libraries listed by Maven.
Using a combination of the following got the example code working at least:
After testing successfully I then checked to see if this set of dependencies would work with netlib 0.0.4-SNAPSHOT, however this gave the same
java.lang.ClassNotFoundException: org.spongycastle.jce.provider.BouncyCastleProvider
error.
Upvotes: 0
Reputation: 29997
This works fine for me (I used maven to bring the dependencies), and this is the list of dependencies I got
org.silvertunnel-ng:netlib:jar:0.0.3:compile
org.apache.directory.studio:org.apache.httpcomponents.httpcore:jar:4.1.2:compile
org.apache.httpcomponents:httpcore:jar:4.1.2:compile
org.apache.directory.studio:org.apache.httpcomponents.httpclient:jar:4.1.2:compile
org.apache.httpcomponents:httpclient:jar:4.1.2:compile
org.apache.httpcomponents:httpmime:jar:4.3:compile
org.bouncycastle:bcprov-jdk15on:jar:1.50:compile
org.bouncycastle:bcpkix-jdk15on:jar:1.50:compile
org.slf4j:slf4j-api:jar:1.7.7:compile
The only dependency I imported from maven is
<dependency>
<groupId>org.silvertunnel-ng</groupId>
<artifactId>netlib</artifactId>
<version>0.0.3</version>
</dependency>
Interesingly, the class org.spongycastle.jce.provider.BouncyCastleProvider
isn't in any of the jars ang googling a bit I found that that class exists in an unofficial fork of Bouncy Castle... so maybe you got one of your libraries from that fork.
If you want I can put this up in github.
Upvotes: 1