NoClassDefFoundError from Processing Example

306 views
Skip to first unread message

Daniel Carroll

unread,
Feb 18, 2012, 5:31:44 PM2/18/12
to xbee-api
I'm brand new to XBee API programming and I have no clue where to
start. I followed the steps on

http://code.google.com/p/xbee-api/wiki/Processing

exactly, but when I try to run the code I get

Exception in thread "Animation Thread" java.lang.NoClassDefFoundError:
org/apache/log4j/Logger
at com.rapplogic.xbee.api.XBee.<clinit>(XBee.java:42)
at sketch_feb18a.setup(sketch_feb18a.java:46)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 5 more

I have no clue what's going on and would greatly appreciate any help.

Also, seeing as I need to know this eventually, how should I export
the code to the XBee; I couldn't really find any documentation or
procedures for this.

andrew

unread,
Feb 20, 2012, 2:31:59 PM2/20/12
to xbee-api
The issue here is the log4j.jar cannot be found. Did you load the jar
files into processing per the wiki:

After starting Processing, the first thing we need to do is add the
XBee-API JAR files. The easiest way to do this is to drag the JAR
files into the Processing window. The required files are xbee-api-
version-.jar and log4j.jar. The RXTX libraries are already included in
Processing.

If you want to run outside of processing, you can just put the code
from setup into the main method and also copy the code from
readPackets into main. Don't forget to add the jars to your classpath
and also the rxtx native lib

Daniel Carroll

unread,
Feb 28, 2012, 9:21:29 PM2/28/12
to xbee...@googlegroups.com
Thanks, I got it at least a step farther.  When I try to run the code now I eventually get the message that the XBee failed to initialize with the error:

com.rapplogic.xbee.api.XBeeException: AT command timed-out while attempt to set/read in API mode.  The XBee radio must be in API mode (AP=2) to use with this library
at com.rapplogic.xbee.api.XBee.doStartupChecks(XBee.java:124)
at com.rapplogic.xbee.api.XBee.initConnection(XBee.java:170)
at com.rapplogic.xbee.api.XBee.open(XBee.java:142)
at sketch_feb28a.setup(sketch_feb28a.java:71)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)


I used XCTU to program the XBee in API mode 2, but that didn't help the problem.  I also get a warning about the log4 file but that doesn't seem to be as pressing:

log4j:WARN No appenders could be found for logger (com.rapplogic.xbee.api.InputStreamThread).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN No appenders could be found for logger (com.rapplogic.xbee.api.InputStreamThread).
log4j:WARN Please initialize the log4j system properly.

I'm assuming this is because I just commented out the configuration line since it gave errors when I tried to insert the data path (maybe because it had spaces, no real way for me to know tho).

If you could give another piece of wisdom I would be very grateful.

Thanks,

Daniel

--
You received this message because you are subscribed to the Google Groups "xbee-api" group.
To post to this group, send email to xbee...@googlegroups.com.
To unsubscribe from this group, send email to xbee-api+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xbee-api?hl=en.


Reply all
Reply to author
Forward
0 new messages