This is my JSP code to connect to the gtlak when i am upload this page on local apache tomcat is working fine but when i am upload it on a live
server it give me exception
XMPPError connecting to talk.google.com:5222
and when i try to change port
SASL authentication PLAIN failed: not-authorized
<%@page
import="java.io.IOException,
org.jivesoftware.smack.ChatManager,
org.jivesoftware.smack.ConnectionConfiguration,
org.jivesoftware.smack.ConnectionListener,
org.jivesoftware.smack.MessageListener,
org.jivesoftware.smack.XMPPConnection,
org.jivesoftware.smack.XMPPException,
org.jivesoftware.smack.packet.Message,
org.jivesoftware.smack.packet.Presence"%>
<%!
ConnectionConfiguration connConfig = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
XMPPConnection connection = new XMPPConnection(connConfig);
public void jspInit()
{
}
public void jspDestroy()
{
connection.disconnect();
System.out.println("Never gets executed ");
}
%>
<%
System.out.println("Starting IM client");
try
{
connection.connect();
response.getWriter().write("Connected to " + connection.getHost());
}
catch (XMPPException ex)
{
response.getWriter().write("Failed to connect to " + connection.getHost());
}
try
{
connection.login("userid@gmail.com", "testing");
response.getWriter().write("Logged in as " + connection.getUser());
Presence presence = new Presence(Presence.Type.available);
connection.sendPacket(presence);
}
catch (XMPPException ex)
{
response.getWriter().write("Failed to log in as " +ex.getMessage()+""+connection.getUser());
}
%>