Showing posts with label spark. Show all posts
Showing posts with label spark. Show all posts

Saturday, 30 May 2015

Spark cannot connect to Openfire Server

If you try login or new register using spark to openfire and openfire runing but you are enable to connect openfire .
  
   you can connect to openfire by other system using spark then change advanced setting of spark
  

   Go to advanced tab of spark and check use old SSL port method


how to install spark on ubuntu

Step 1:


  download spark  click here
 
   or

 use this command

wget http://download.igniterealtime.org/spark/spark_2_6_3.tar.gz

 

step 2: 

  Now  extract tar file Using this command

 tar -zxvf spark_2_7_0.tar.gz

and it makes Spark folder

Step 3:
  
  Now  go to in Spark  folder and run this Command

Dell-System-Inspiron-N4110:~/Spark$  ./Spark


After this you can see spark windows






Saturday, 4 April 2015

Get Roster List From XMPP IM with Smack API in Java Application

package com.javaproficiency.demo;

import java.util.Collection;

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;

public class GETRoster {
    public static void main(String[] args) {
        GETRoster getRoster = new GETRoster();
        XMPPConnection connection = getRoster.Connect();


       // Login User
        getRoster.loginUser(connection);
  
    // Get Roster Of Login User
        Roster roster = connection.getRoster();
        Collection<RosterEntry> entries = roster.getEntries();
        for (RosterEntry entry : entries) {
            System.out.println("name=" + entry.getName() + "userName="
                    + entry.getUser());
        }
        connection.disconnect();
    }
   
    public void loginUser(XMPPConnection connection){
        try {
            connection.login("userName","Password");
        } catch (XMPPException e) {
           
            e.printStackTrace();
        }
    }

    /**
     *
     * @return XMPP Connection
     */

    public XMPPConnection Connect() {

        ConnectionConfiguration config = new ConnectionConfiguration(
                "localhost", 5222);

        /*
         * ConnectionConfiguration config = new ConnectionConfiguration(
         * "192.163.2.200", 5222);
         */
        XMPPConnection connection = new XMPPConnection(config);
        try {
            connection.connect();
        } catch (XMPPException e) {

            e.printStackTrace();
        }
        return connection;
    }

}

Login to XMPP IM with Smack for Java applications

Maven dependency

<dependency>
            <groupId>jivesoftware</groupId>
            <artifactId>smack</artifactId>
            <version>3.1.0</version>
 </dependency>
<dependency>
            <groupId>jivesoftware</groupId>
            <artifactId>smackx</artifactId>
            <version>3.1.0</version>
   </dependency>


package com.javaproficiency.demo;

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;

public class LoginSmack {
          public static void main(String[] args) {
              LoginSmack loginSmack=new LoginSmack();
            XMPPConnection connection=loginSmack.Connect();
          
            try {
                connection.login("Username","Password");
            } catch (XMPPException e) {
               
                e.printStackTrace();
            }
            System.out.println("Login Successfully");
        }
         
          /**
           *
           * @return XMPP Connection
           */
         
          public XMPPConnection Connect() {
             
              ConnectionConfiguration config = new ConnectionConfiguration(
                      "localhost", 5222);

              /*
               * ConnectionConfiguration config = new ConnectionConfiguration(
               * "192.163.2.200", 5222);
               */
              XMPPConnection connection = new XMPPConnection(config);
              try {
                  connection.connect();
              } catch (XMPPException e) {
             
                  e.printStackTrace();
              }
              return connection;
          }
         
      
}

Openfire Server Tutorial