hi
i’'m getting a xmlpull parser exception.can anyone hlep me to fix it ??
bye
sara
hi
i’'m getting a xmlpull parser exception.can anyone hlep me to fix it ??
bye
sara
Sara
Exception where ? Please post some code so that someone can try to have a look.
-Rajesh
hi
i’'m trying to execute this simple program
import org.jivesoftware.smack.*;
public class connector {
public static void main(String[] args) {
try {
XMPPConnection connection = new XMPPConnection(“jabber.org”, 5222);
connection.login(“XXX”,“XXX”);
System.out.println(“OK”);
} catch (Exception e) {
System.out.println(“Failed”);
}
}
}
but I get the following error
Exception in thread “main” java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPul
lParserException
at org.jivesoftware.smack.XMPPConnection.init(XMPPConnection.java:638)
at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:176)
at connector.main(connector.java:7)
wat do I have to do to remove this error ?
sara
sara,
Can you provide some more details about how you’'re running the program? Is this command-line? Also, did you compile Smack yourself or use a binary release?
Regards,
Matt
hi
i’'m running the prgm command line.
i’'m using Developer Edition (Binary, Documentation, Source, Build Tools) – Smack 1.2.1
i’'ve followed the instructions of setting up and when i type ant to compile to the smack files.i get few errors saying the following.
C:\smack\build>ant compile
Buildfile: build.xml
compile:
Compiling 11 source files to C:\smack\classes
C:\smack\source\org\jivesoftware\smackx\packet\Time.java:69: getTime
InMillis() has protected access in java.util.Calendar
cal.getTimeInMillis() - timeZone.getOffset(cal.getTi
meInMillis())));
^
C:\smack\source\org\jivesoftware\smackx\packet\Time.java:69: getTime
InMillis() has protected access in java.util.Calendar
cal.getTimeInMillis() - timeZone.getOffset(cal.getTi
meInMillis())));
^
C:\smack\source\org\jivesoftware\smackx\packet\Time.java:69: cannot
resolve symbol
symbol : method getOffset (long)
location: class java.util.TimeZone
cal.getTimeInMillis() - timeZone.getOffset(cal.getTi
meInMillis())));
^
C:\smack\source\org\jivesoftware\smackx\packet\Time.java:86: getTime
InMillis() has protected access in java.util.Calendar
cal.getTimeZone().getOffset(cal.getTimeInMillis(
))));
^
C:\smack\source\org\jivesoftware\smackx\packet\Time.java:86: cannot
resolve symbol
symbol : method getOffset (long)
location: class java.util.TimeZone
cal.getTimeZone().getOffset(cal.getTimeInMillis(
))));
^
C:\smack\source\org\jivesoftware\smackx\packet\Time.java:103: cannot
resolve symbol
symbol : method getOffset (long)
location: class java.util.TimeZone
time.getTime() - TimeZone.getDefault().getOffset(tim
e.getTime())));
^
6 errors
BUILD FAILED
file:C:/smack/build/build.xml:79: Compile failed; see the compiler error output
for details.
Total time: 3 seconds
how do i fix the problem ??.do u think because of this i’'m getting the xmlpullparser exception.
bye
Sara
cracker,
A few things:
What JDK are you using? You can check by typing java -version on the command line.
You need to use the command “ant jar” to build Smack for your use. Once you do, it will create a smack.jar and smackx.jar. Put those two JAR files in your classpath such as with:
java -cp smack.jar;smackx.jar;yourJAR.jar com.yourprogram.MainClass
Regards,
Matt
hi Matt
I’'m using Java2 SDK,Std Edition Version 1.3.1.
in the readme file of the smack i have downloaded it says to set-up java_home variable(which i did) and then go to build folder and type ant.
i’‘ve set the path for ant and it is being invoked properly.as i’'ve shown in my previous message.
one more thing i already see two jar files in smack folder even before i invoke ant.
when i invoke ant in build folder i get the errors posted in previous mail.
to execute the prgm i’'m doing something like this
i’'ve set the class path of two jar files in smack folder,even tough the
all my java files are in C:smack\classes folder.
i’'m following a normal java prgm execution
to compile
C:\smack\classes>javac connector.java
here do i need to give the two jar files path ??? i dont get any error here.
but i when i say
C:\smack\classes>java connector
Exception in thread “main” java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPu
lParserException
at org.jivesoftware.smack.XMPPConnection.init(XMPPConnection.java:638)
at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:176
at connector.main(connector.java:7)
do u think i’‘m using the right method to compile my file.i’'m not getting the exact meaning of this statement
java -cp smack.jar;smackx.jar;yourJAR.jar com.yourprogram.MainClass
u gave in previous mail.can please tell me how to write the command for my connector.java .i dont have any jar file so can i omit that??
wat should i write instead of com.yourprogram.MainClass i’'m writing connector but get an error.
do think there is error in setting up the smack only.because i get errors when i try to build the smack.
Sara
i forgot to mention that i’‘m trying to connect to the jive messenger installed on my system.i dont think i need to have any special API for that.because when my server(jive) is down and i’'m trying to connect it says unable to connect and when it is up it connects but i get xmlpull parse error.
do u think i’‘m getting this error because i’‘m unable to build the smack API i’'ve downloaded.
Sara
hi
i was giving a wrong path.now i’'m correct path.sorry i was posting very long messages.
now i’'m trying to deal with roster and other things.
i shall keep posting my progress.Thanks Matt.
Sara
Sara,
The command would be:
java -cp …/lib/smack.jar;…/lib/smackx.jar Connector
You should not put your own class in the classes directory of the Smack distribution. Instead, create your own project folder. Let’'s say you call it Connector. Then have a lib folder and a classes folder. Put Connector.class in classes and smack.jar and smackx.jar in lib. Then from the classes directory use the command I gave above.
Regards,
Matt
Thanks Matt i’'m getting it now
Sara