So I use Smack to launch my bot chat for the League of Legends, however I cannot even get the bot to appear due to a missing class error that I cannot understand. Code and error below, Thanks for any help, -Nick
Also: yes, this code was taken from an example, because when I tried it myself, I still had the same error.
package com.nickparks.bot; import java.util.*; import java.io.*; import org.jivesoftware.smack.*; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.tcp.XMPPTCPConnection; public class JabberSmackAPI implements MessageListener{ XMPPConnection connection; public void login(String userName, String password) throws XMPPException { ConnectionConfiguration config = new ConnectionConfiguration("chat.na1.lol.riotgames.com",5223); connection = new XMPPTCPConnection(config); try { connection.connect(); connection.login(userName, password, "xiff"); } catch (SmackException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public void displayBuddyList() { Roster roster = connection.getRoster(); Collection<RosterEntry> entries = roster.getEntries(); System.out.println("\n\n" + entries.size() + " buddy(ies):"); for(RosterEntry r:entries) { System.out.println(r.getUser()); } } public void disconnect() { try { connection.disconnect(); } catch (SmackException.NotConnectedException e) { e.printStackTrace(); } } public void processMessage(Chat chat, Message message) { if(message.getType() == Message.Type.chat) System.out.println(chat.getParticipant() + " says: " + message.getBody()); } public static void main(String args[]) throws XMPPException, IOException {
And here is the error I get:
Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserFactory at org.jivesoftware.smack.SmackConfiguration.processConfigFile(SmackConfiguration.java:321) atorg.jivesoftware.smack.SmackConfiguration.processConfigFile(SmackConfiguration.java:316) at org.jivesoftware.smack.SmackConfiguration.<clinit>(SmackConfiguration.java:148) at org.jivesoftware.smack.ConnectionConfiguration.<init>(ConnectionConfiguration.java:65) at com.nickparks.bot.JabberSmackAPI.login(JabberSmackAPI.java:16) at com.nickparks.bot.JabberSmackAPI.main(JabberSmackAPI.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.ClassNotFoundException: org.xmlpull.v1.XmlPullParserFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 11 more
source share