Java help, XMPP client (using Smack API) configuration problems

Watch this thread
19lollipop91
Badges: 0
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#1
Report Thread starter 7 years ago
#1
Hi all,

First time making a Java XMPP client and having configuration difficulties. Using the Smack API 4.0.4. Initially was getting an error on line:

Code:
ConnectionConfiguration config = new ConnectionConfiguration(host,
            port);
Saying:

Code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserFactory
Did some research and found out that the new version of Smack does not bundle everything so had to get XPP3 and add it to my class path. Now I am getting a new error which I cannot solve, the error being:

Code:
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
	at org.jivesoftware.smack.ConnectionConfiguration.<init>(ConnectionConfiguration.java:67)
Here is the code regarding connection, only have one other file in project so far and that is a small GUI for user input:

Code:
import java.io.*;

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;

public class LoginAccount{

private XMPPConnection connection;

LoginAccount(String host, int port, String userName, String password) throws XMPPException, SmackException, IOException {

    ConnectionConfiguration config = new ConnectionConfiguration(host,
            port);

    connection = new XMPPTCPConnection(config);
    connection.connect();
    connection.login(userName, password);
}
}
Tried asking tutors and other students at university to no success. Any help would be great.
0
reply
TSR Learn Together
Badges: 9
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#2
Report 7 years ago
#2
Hi there,

While you're waiting for an answer, did you know we have 300,000 study resources that could answer your question in TSR's Learn together section?

We have everything from Teacher Marked Essays to Mindmaps and Quizzes to help you with your work. Take a look around.

If you're stuck on how to get started, try creating some resources. It's free to do and can help breakdown tough topics into manageable chunks. Get creating now.

Thanks!

Not sure what all of this is about? Head here to find out more.
0
reply
BurningCa007
Badges: 0
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#3
Report 7 years ago
#3
May I point you in the direction of the StackOverflow answer here

Basically, you might need to add additional jar files (from another library - XPP3), I received no further exceptions that you list after incorporating them. Enjoy.
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

How did your Edexcel A-level Economics Paper 1 go?

Loved the paper - Feeling positive (30)
15.38%
The paper was reasonable (98)
50.26%
Not feeling great about that exam... (48)
24.62%
It was TERRIBLE (19)
9.74%

Watched Threads

View All