powered by Jive Software

Newbee questions :-(

Hello there.

I´ve installed smack successfully on my system. And want to connect to a server. After this I have used a username and password to login(not really existing). Now my questions:

  • How can i get an account? Or stores the server an account if he haven´t the username in database?

  • Can anyone tell me the problem with the code, or better: give me an example?

CODE:


<%!

String server = “jabber.org”;

%>

<%

out.println(“connecting…
”);

//try

//{

XMPPConnection conn = new XMPPConnection(server);

if(conn.isConnected())

{

out.println(“at -“server”- connected
”);

conn.login(“myUserName”,“myPasswd”);

//Chat chat = new Chat(conn,“Marcel”);

}

else

{

out.println(“not connected with -“server
”);

}

//}

//catch (Exception XMPPe)

//{

// out.println(“an error :-(”);

//}

%>

EXCEPTION:


Error: 500

Location: /smack/smacktest.jsp

Internal Servlet Error:

java.lang.NullPointerException

at org.jivesoftware.smack.XMPPException.printStackTrace(XMPPException.java:101)

Marcel,

Hello there.

Iýve installed smack successfully on my system. And

want to connect to a server. After this I have used a

username and password to login(not really existing).

Now my questions:

  • How can i get an account? Or stores the server an

account if he havenýt the username in database?

The Smack API (and someone correct me if I’‘m wrong) currently is not setup to handle registration in an easy manner, so creating a new account on a server is going to be difficult. If you’'re going to be doing a lot of Jabber work you should look into setting up your own Jabber server. Look here http://www.jabber.org/admin/serverlist.php there are a couple of open-source Jabber server solutions available and a couple of commerical ones are free if you have less than 5 clients.

  • Can anyone tell me the problem with the code, or

better: give me an example?

Once you get an account setup try using this little snippet of code:

import org.jivesoftware.smack.*; public class SmackTest {    private String jHost = "myjabberserver";
   private XMPPConnection connection = null;    public SmackTest() {
         try {
      connection = getConnection(jHost);       connection.login("user1", "test");
      connection.createChat("user2@myjabberserver").sendMessage("Howdy!");       } catch (Exception ex) {
         ex.printStackTrace();
      }
   }    private XMPPConnection getConnection(String host) throws XMPPException {
      XMPPConnection.DEBUG_ENABLED = true;
      return new XMPPConnection(host);
   }    public static void main(String[] args) {
      new SmackTest();
   }
}

It’‘s just a slight extension of the code that can be found on Smack’'s home page. Once you get that running start adding little things, like taking input from the console, adding a little GUI, etc.

By the way, JabberD server (for Win32, IMHO in *NIX versions there are the same) with default settings requires only user login and password for registration.

So basic registration support implementation wouldnt take much time.

To Matt: how about adding it in Beta3?

Registration is definitely on the wish list. We’'re trying to get presence/roster squared away first but would welcome any contributions if someone has already created a solution.

-iain

To Matt: how about adding it in Beta3?

I’'ve filed an issue in the tracker to implement this for beta 3.

Thanks,

Matt

i have a prototype of Smack modification for registration support and it works now, but needs some additional work on it to clear and comment code

i’'ve finished with comments and tested it again. You tald about contribution. How i can to contribute?

Roman,

Why don’‘t you attach the files to an email and send them to me? It’‘s a bummer that we didn’'t coordinate better on development of this feature, though. I also worked on registration this weekend and am mostly done with the feature. Perhaps I can try to combine our work together.

Thanks,

Matt

I have proposition: you can publish your plans for further Smack development

I have proposition: you can publish your plans for

further Smack development

In general, I always try to keep the issue tracker up-to-date. However, I’‘ll also start using the “in-progress” feature more so that people can tell what I’'m currently working on.

Regards,

Matt

i mean not only things that are already in progress but those that are only planned for future versions

maybe would like to implement and contribute it

The only things on the road-map are those items that are in the issue-tracker. So, if you have ideas for new features or improvements, I’‘d love to hear them, and then I’‘ll add them to the issue tracker. I’‘d also be happy to set you up with a account in the issue tracker if you’'re going to be working on issues.

Some things that are needed off the top of my head:

  • Unit testing framework and tests (using JUnit).

  • Example code snippets and applications.

  • MUC support (the new protocol that improves upon GroupChat).

Regards,

Matt

now i have no ideas - im porting my components to beta 3

but i think that in near future i will be able to found what additional features is needed for production use (after launching first stage of our communication system) and provide example code snippets from it (now i have right to do this)

and i would be glad to help in working on issues