You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Tharindu Rusira <th...@gmail.com> on 2013/11/28 07:56:13 UTC

java.lang.NoClassDefFoundError: com/google/common/base/Preconditions

Hi all,
I'm working on Mahout 0.9-SNAPSHOT version checked out from the svn trunk.
The following code generates java.lang.NoClassDefFoundError:
com/google/common/base/Preconditions where b is supposed to be true
(because both cardinality and the values are same in the two vectors dv and
sv)

// --------------- start code -----------------

double[] vals= new double[]{2.3, 2.56,4.66};

DenseVector dv=new DenseVector(vals);

Vector sv= new SequentialAccessSparseVector(3);

 for(int i=0;i<vals.length;i++){

  sv.set(i,vals[i]);

}


boolean b=dv.equals(sv);

System.out.println(b);

// --------------- end code -----------------


Where are the classes that execute these Preconditions? Are they shipped
with Mahout or am I missing something (apparently com.google.common.base)
in my standard Java library?


Thanks,

Re: java.lang.NoClassDefFoundError: com/google/common/base/Preconditions

Posted by Suneel Marthi <su...@yahoo.com>.
Good. (No I am not interested in the patch, Thanks :) )





On Thursday, November 28, 2013 2:54 AM, Tharindu Rusira <th...@gmail.com> wrote:
 
Yes that's the exact issue Suneel, it was a careless mistake while adding projects to Eclipse that I missed those .jars. 
I even messed with the code to find a workaround so that it does not require these Precondition checks. (I've attached a patch if you are interested) :)

Thanks a lot. 
-Tharindu


On Thu, Nov 28, 2013 at 12:29 PM, Suneel Marthi <su...@yahoo.com> wrote:

you r missing Google Guava library which has these classes.  R u running a mvn build on Mahout snapshot?
>
>
>
>
>
>
>On Thursday, November 28, 2013 1:56 AM, Tharindu Rusira <th...@gmail.com> wrote:
>
>Hi all,
>I'm working on Mahout 0.9-SNAPSHOT version checked out from the svn trunk.
>The following code generates java.lang.NoClassDefFoundError:
>com/google/common/base/Preconditions where b is supposed to be true
>(because both cardinality and the values are same in the two vectors dv and
>sv)
>
>// --------------- start code -----------------
>
>double[] vals= new double[]{2.3, 2.56,4.66};
>
>DenseVector dv=new DenseVector(vals);
>
>Vector sv= new SequentialAccessSparseVector(3);
>
>for(int i=0;i<vals.length;i++){
>
>  sv.set(i,vals[i]);
>
>}
>
>
>boolean b=dv.equals(sv);
>
>System.out.println(b);
>
>// --------------- end code -----------------
>
>
>Where are the classes that execute these Preconditions? Are they shipped
>with Mahout or am I missing something (apparently com.google.common.base)
>in my standard Java library?
>
>
>Thanks,


-- 

M.P. Tharindu Rusira Kumara

Department of Computer Science and Engineering,
University of Moratuwa,
Sri Lanka.
+94757033733
www.tharindu-rusira.blogspot.com

Re: java.lang.NoClassDefFoundError: com/google/common/base/Preconditions

Posted by Isabel Drost-Fromm <is...@apache.org>.
On Thu, 28 Nov 2013 13:24:26 +0530
Tharindu Rusira <th...@gmail.com> wrote:

> Yes that's the exact issue Suneel, it was a careless mistake while
> adding projects to Eclipse that I missed those .jars.

When changing Mahout code make sure to either run

mvn eclipse:eclipse before importing the project into your workspace or
enable maven support in Eclipse.

When integrating Mahout into your project it's best to use Maven, Ivy,
Gradle or some other build system that supports resolving transitive
dependencies automatically to avoid these issues.


Isabel

Re: java.lang.NoClassDefFoundError: com/google/common/base/Preconditions

Posted by Tharindu Rusira <th...@gmail.com>.
Yes that's the exact issue Suneel, it was a careless mistake while adding
projects to Eclipse that I missed those .jars.
I even messed with the code to find a workaround so that it does not
require these Precondition checks. (I've attached a patch if you are
interested) :)

Thanks a lot.
-Tharindu

On Thu, Nov 28, 2013 at 12:29 PM, Suneel Marthi <su...@yahoo.com>wrote:

> you r missing Google Guava library which has these classes.  R u running a
> mvn build on Mahout snapshot?
>
>
>
>
>
> On Thursday, November 28, 2013 1:56 AM, Tharindu Rusira <
> tharindurusira@gmail.com> wrote:
>
> Hi all,
> I'm working on Mahout 0.9-SNAPSHOT version checked out from the svn trunk.
> The following code generates java.lang.NoClassDefFoundError:
> com/google/common/base/Preconditions where b is supposed to be true
> (because both cardinality and the values are same in the two vectors dv and
> sv)
>
> // --------------- start code -----------------
>
> double[] vals= new double[]{2.3, 2.56,4.66};
>
> DenseVector dv=new DenseVector(vals);
>
> Vector sv= new SequentialAccessSparseVector(3);
>
> for(int i=0;i<vals.length;i++){
>
>   sv.set(i,vals[i]);
>
> }
>
>
> boolean b=dv.equals(sv);
>
> System.out.println(b);
>
> // --------------- end code -----------------
>
>
> Where are the classes that execute these Preconditions? Are they shipped
> with Mahout or am I missing something (apparently com.google.common.base)
> in my standard Java library?
>
>
> Thanks,
>



-- 
M.P. Tharindu Rusira Kumara

Department of Computer Science and Engineering,
University of Moratuwa,
Sri Lanka.
+94757033733
www.tharindu-rusira.blogspot.com

Re: java.lang.NoClassDefFoundError: com/google/common/base/Preconditions

Posted by Suneel Marthi <su...@yahoo.com>.
you r missing Google Guava library which has these classes.  R u running a mvn build on Mahout snapshot?





On Thursday, November 28, 2013 1:56 AM, Tharindu Rusira <th...@gmail.com> wrote:
 
Hi all,
I'm working on Mahout 0.9-SNAPSHOT version checked out from the svn trunk.
The following code generates java.lang.NoClassDefFoundError:
com/google/common/base/Preconditions where b is supposed to be true
(because both cardinality and the values are same in the two vectors dv and
sv)

// --------------- start code -----------------

double[] vals= new double[]{2.3, 2.56,4.66};

DenseVector dv=new DenseVector(vals);

Vector sv= new SequentialAccessSparseVector(3);

for(int i=0;i<vals.length;i++){

  sv.set(i,vals[i]);

}


boolean b=dv.equals(sv);

System.out.println(b);

// --------------- end code -----------------


Where are the classes that execute these Preconditions? Are they shipped
with Mahout or am I missing something (apparently com.google.common.base)
in my standard Java library?


Thanks,