java.lang.NoClassDefFoundError: org/apache/commons/lang/Validate

153 views
Skip to first unread message

Francisco Dans

unread,
Dec 25, 2012, 2:32:34 PM12/25/12
to javageomod...@googlegroups.com
Hi guys,

I'm trying to implement javageomodel in my app, but I'm not using Maven. Everything seems quite straight forward but when I try a request on it I get this error. I've tried adding org.apache.commons.lang to the build path but that doesn't help. If this is an issue related to not using maven, I don't know how to integrate it with my project. Thanks a lot!

java.lang.NoClassDefFoundError: org/apache/commons/lang/Validate
at com.beoui.geocell.model.Point.<init>(Point.java:33)
at com.beoui.geocell.model.BoundingBox.<init>(BoundingBox.java:39)
at com.panstudio.RunningAppServer.Run.detectNearby(Run.java:183)
at com.panstudio.RunningAppServer.Run.<init>(Run.java:55)

This is the relevant code:
public ArrayList<Run> detectNearby(){
    ArrayList<Run> nearList = new ArrayList<Run>();
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
   
    float latThreshold = (float)0.002;
    float lonThreshold = (float)0.003;
   
    BoundingBox boundingBox = new BoundingBox(centroidLat+latThreshold,centroidLon-lonThreshold,centroidLat-latThreshold,centroidLon+lonThreshold);
    List<String> cells = GeocellManager.bestBboxSearchCells(boundingBox, null);
    Filter hashFilter =
     new FilterPredicate("geoCells",
                         FilterOperator.IN,
                         cells);
    Query q = new Query("Run").setFilter(hashFilter);
   
    PreparedQuery pq = datastore.prepare(q);

Kapil Pendse

unread,
Dec 25, 2012, 11:15:33 PM12/25/12
to javageomod...@googlegroups.com, javageomod...@googlegroups.com
Hi Francisco,

Are you using the geocell jar file or source code? It seems like your setup is able to find the com.beoui.geocell.model.BoundingBox class but not the com.beoui.geocell.model.Point class. What is your class path?

Regards,
Kapil

Sent from my iPhone

Francisco Dans

unread,
Dec 25, 2012, 11:41:49 PM12/25/12
to javageomod...@googlegroups.com
Hi Kapil,

Thank you very much for your reply. I'm using the jar, downloaded via browser. It appears as if the Validate class that is referenced in com.beoui.geocell.model.Point is not found, so it seems like the setup finds the Point class, it's just the library that is not there. Any clues?

Thanks again!

Kapil Pendse

unread,
Dec 26, 2012, 12:08:07 AM12/26/12
to javageomod...@googlegroups.com
Hi Francisco,

I've tried adding org.apache.commons.lang to the build path but that doesn't help.

Assuming that you are using Eclipse IDE to configure your build path, make sure that you have the commons-lang-x.x.jar file in the referenced libraries. If not, click on Add JAR or Add External JAR to add it.

If you have using command line to compile, ensure that you provide the full path and file name in the classpath, like this:

/path/to/commons-lang-x.x.jar

Another thing to check would be is your JAR file really there at the location you specify? Maybe there's a typo in your classpath? :-)

Kapil
--
"The Power to Imagine, is The Power to Create!"

Francisco Dans

unread,
Dec 26, 2012, 12:52:45 AM12/26/12
to javageomod...@googlegroups.com
I've tried erasing the library and adding it again to the build path. As this didn't work I checked the .classpath file but there isn't anything weird there. My build path right now looks like this:

Inline image 1

Does using Maven do any difference? I've no idea of how to use it.

Thanks a lot
buildpath.PNG

Kapil Pendse

unread,
Dec 26, 2012, 1:35:20 AM12/26/12
to javageomod...@googlegroups.com
Not quite sure if it matters, but have you tried playing with the order in which the JARs are stacked up in that list?
buildpath.PNG

Kapil Pendse

unread,
Dec 26, 2012, 1:47:41 AM12/26/12
to javageomod...@googlegroups.com
You can try the JAR file I built from source few months ago:

buildpath.PNG

Francisco Dans

unread,
Dec 26, 2012, 1:48:38 AM12/26/12
to javageomodel-discuss
I thought we had something there, but it doesn't work if I change the order. Is it possible to recompile the project with the Point class edited so that it doesn't have that dependency? I cloned the Subversion repo and fix it but when I try to create the jar the project doesn't appear.
buildpath.PNG

Francisco Dans

unread,
Dec 26, 2012, 1:59:32 AM12/26/12
to javageomodel-discuss
Thanks for the jar, it gives me the same error. How about what I suggested in the previous post? Thanks again for your help/
buildpath.PNG

Kapil Pendse

unread,
Dec 26, 2012, 11:37:00 AM12/26/12
to javageomod...@googlegroups.com
I cloned the Subversion repo and fix it but when I try to create the jar the project doesn't appear.
What modifications did you do and what was the error message? The Point is a very basic class in this library so any change there could affect many other places.
buildpath.PNG

Francisco Dans

unread,
Dec 26, 2012, 12:28:10 PM12/26/12
to javageomodel-discuss
Nah, I tried recompiling the jar adding manually the libraries but that did not work. I've no idea of what's causing this but it's really frustrating! Do you know of any alternative to javageomodel to do geoqueries to the datastore?

Thanks a lot
buildpath.PNG

Francisco Dans

unread,
Dec 26, 2012, 12:39:41 PM12/26/12
to javageomodel-discuss
It's really weird because I removed the call for Validate in the Point class, recompiled the jar, and added it to my app's build path but when I run it, it´s still calling it.
buildpath.PNG

Dmitry Ryzhov

unread,
Dec 27, 2012, 2:33:59 PM12/27/12
to javageomod...@googlegroups.com


вторник, 25 декабря 2012 г., 23:32:34 UTC+4 пользователь Francisco Dans написал:

Dmitry Ryzhov

unread,
Dec 27, 2012, 2:34:29 PM12/27/12
to javageomod...@googlegroups.com
I have the same prolem. It is already at new Point(lat, lon) - error java.lang.NoClassDefFoundError: com/beoui/geocell/model/Point

среда, 26 декабря 2012 г., 21:39:41 UTC+4 пользователь Francisco Dans написал:

Juan Mengual

unread,
Jan 7, 2013, 7:46:12 AM1/7/13
to javageomod...@googlegroups.com
Same issue for me. I have try same things as Francisco (getting apache commons lang) and keep not working. I am no using Maven but my question is, when using maven does it work? May be a better solution for me than diggin into the source (I will be doing that while waiting for an answer :)).
Thanks!
Reply all
Reply to author
Forward
0 new messages