java.security.NoSuchAlgorithmException: TLS

Hi !

i have a problem , i try to use Smack for the First Time , but i have an Error !

that is my Source code :


import org.jivesoftware.smack.*;

public class test1 {

/**

  • @param args

*/

public static void main(String[] args) {

XMPPConnection con;

try {

con = new XMPPConnection(“mathieu-pc”);

con.login(“devel”, “****”);

con.createChat(“kedare@mathieu-pc”)

.sendMessage(“Howdy!”);

} catch (XMPPException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}


and the Error :


java.security.NoSuchAlgorithmException: TLS

at javax.net.ssl.SSLContext.getInstance(libgcj.so.7)

at org.jivesoftware.smack.SSLXMPPConnection$DummySSLSocketFactory.<init>(SSL XMPPConnection.java:110)

at org.jivesoftware.smack.SSLXMPPConnection.<clinit>(SSLXMPPConnection.java: 45)

at java.lang.Class.initializeClass(libgcj.so.7)

at java.lang.Class.isInstance(libgcj.so.7)

at org.jivesoftware.smack.PacketWriter.openStream(PacketWriter.java:365)

at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:255)

at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:39)

at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:80)

java.security.NoSuchAlgorithmException: TLS

at javax.net.ssl.SSLContext.getInstance(libgcj.so.7)

at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:11 07)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:330)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:64)

java.lang.NullPointerException

at org.jivesoftware.smack.SASLAuthentication.send(SASLAuthentication.java:406)

at org.jivesoftware.smack.sasl.SASLMechanism.authenticate(SASLMechanism.java:69)

at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 193)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:426)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:390)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:371)

at test1.main(test1.java:14)

No response from the server.:

at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication .java:58)

at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 223)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:426)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:390)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:371)

at test1.main(test1.java:14)


what the problem ?

thanks

(sorry for my bad english)

Message was edited by: kedare

Are you using linux? If yes do u have libgcj.so in your native lib path?

Are you using the binary version of Smack ??? If not try to use binary version instead of source one.

What version of Smack are you using?

Let me know

Yes im using Linux

Yes i have this file (but im use the SUN JSDK/JRE)

im using Smack 2.2.1

Ok,

Now, try to set your java.library.path variable that handles native libs.

So try to add this command in your java command line. ( -Djava.library.path= /user/home/MY_JAVA_NATIVE_LIBS/ )

Java needs some extra declarations when it uses native libraries.

Hope Helped.

Hi,

are you using the JRE or the JDK? There were and probably are some java / debugger issues depending on the version one is using. Are you running it within Eclipse or an IDE?

You should have these three version, maybe the jdk version is fine.

./jre1.5.0_08/bin/java

./jdk1.5.0_08/bin/java

./jdk1.5.0_08/jre/bin/java

LG

You wrote:

java.security.NoSuchAlgorithmException: TLS

at javax.net.ssl.SSLContext.getInstance(libgcj.so.7)

Then you wrote:

Yes I have this file (but I’'m using the SUN JSDK/JRE)

No you’‘re not. You’'re using the GNU JRE.

It’‘s an incredibly easy mistake to make. In fact, it’‘s almost impossible to avoid. Modern Linux distributions install multiple JREs and set them up through multiple symlinks through /etc/alternatives and /usr/lib/jvm and other locations. It’‘s all very ugly and confusing and it’'s a pet peeve of mine.

But the fact that you got an error from libgcj.so leaves no doubt that (a) you’'re running the GNU JRE and (b) the JRE is able to find and use libgcj.so.

The problem is exactly what it says: The GNU JRE does not have an implementation of the TLS Algorithm, so it cannot open a connection to the Jabber server. There are two possible ways to fix this problem: (1) Install an implementation of the TLS Algorithm for the GNU JRE, or (2) use the Sun JRE.

To use option 1, you probably need to install “Jessie”. I think I’'ve seen this solve the problem on a RedHat-based distribution and fail to solve it on a Debian-based distribution. It probably has something to do with the configuration and the way the package was built.

Option 2 also depends on your Linux distribution and Java packages. You might need to do something with a command called update-alternatives. You might need to download and install a package called “something-sun-compat-something”. But it’'s probably as simple as editing your path so that the “java” command runs what you want it to run. You probably need to put something like /usr/java/j*/bin early in your path.

Message was edited by: svalente2