Exception in thread "main" java.lang.ExceptionInInitializerError

I add xmlpull_1_0_5.jar but get

Exception in thread “main” java.lang.ExceptionInInitializerError

at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96 )

at org.jivesoftware.smack.ConnectionConfiguration.(ConnectionConfiguration .java:38)

at class_1.main(class_1.java:35)

Caused by: java.lang.IllegalStateException: org.xmlpull.v1.XmlPullParserException: could not load any factory class (even small or full default implementation); nested exception is:

org.kxml2.io.XmlReader

at org.jivesoftware.smack.SmackInitialization.(SmackInitialization.java:11 9)

… 3 more

Caused by: org.xmlpull.v1.XmlPullParserException: could not load any factory class (even small or full default implementation); nested exception is:

org.kxml2.io.XmlReader

at org.xmlpull.v1.XmlPullParserFactory.newInstance(XmlPullParserFactory.java:225)

at org.xmlpull.v1.XmlPullParserFactory.newInstance(XmlPullParserFactory.java:76)

at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitializatio n.java:153)

at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitializatio n.java:148)

at org.jivesoftware.smack.SmackInitialization.(SmackInitialization.java:11 6)

  • import java.io.IOException;
  • import javax.net.ssl.SSLContext;
  • import org.jivesoftware.smack.AbstractXMPPConnection;
  • import org.jivesoftware.smack.SmackException;
  • import org.jivesoftware.smack.XMPPException;
  • import org.jivesoftware.smack.tcp.XMPPTCPConnection;
  • import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
  • public class class_1 {
  • public static void main(String[] args){
  • // TODO Auto-generated method stub
  • // Create a connection to the jabber.org server on a specific port.
  • XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
  • .setUsernameAndPassword(“name”, “pasword”)
  • .setServiceName(“jabber.org”)
  • .setHost(“earl.jabber.org”)
  • .setPort(5222)
  • .build();
  • AbstractXMPPConnection conn2 = new XMPPTCPConnection(config);
  • try {
  • conn2.connect();
  • } catch (SmackException e) {
  • // TODO Auto-generated catch block
  • e.printStackTrace();
  • } catch (IOException e) {
  • // TODO Auto-generated catch block
  • e.printStackTrace();
  • } catch (XMPPException e) {
  • // TODO Auto-generated catch block
  • e.printStackTrace();
  • }
  • }
  • }

HELP PLEASE --------------------

You have to remove that jar file - xmlpull_1_0_5.jar. If you’ve not already got kxml2-2.3.0.jar then add that.

It should clear the error you’re seeing but you may go on to another - different - error.

– Jim