You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by "Kumar, Ranjan" <Ra...@morganstanleysmithbarney.com> on 2011/07/28 16:05:57 UTC

Class loading problem

I have a class to define data I am reading from a MySQL database. According to online tutorials I created a class called MyRecord and extended it from Writable, DBWritable. While running it with hadoop I get a NoSuchMethodException: dataTest$MyRecord.<init>()

I am using 0.21.0

Thanks for your help
Ranjan


--------------------------------------------------------------------------
Important Notice to Recipients:
 
The sender of this e-mail is an employee of Morgan Stanley Smith Barney LLC. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Erroneous transmission is not intended to waive confidentiality or privilege. Morgan Stanley Smith Barney reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers/mssbemail.html. If you cannot access this link, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley Smith Barney you consent to the foregoing.

Re: Class loading problem

Posted by John Armstrong <jo...@ccri.com>.
On Thu, 28 Jul 2011 10:05:57 -0400, "Kumar, Ranjan"
<Ra...@morganstanleysmithbarney.com> wrote:
> I have a class to define data I am reading from a MySQL database.
> According to online tutorials I created a class called MyRecord and
> extended it from Writable, DBWritable. While running it with hadoop I
get a
> NoSuchMethodException: dataTest$MyRecord.<init>()

Hadoop needs a noargs constructor to build the object, which it then fills
in by using readFields().  Many classes come with a default noargs
constructor, which basically defers to the noargs contructor from Object,
or another ancestor class.

HOWEVER

If you defined another constructor that takes arguments, you've implicitly
removed the default noargs constructor on your class.  You need to define
one explicitly, which Hadoop can use to build your objects.

hth