Return-Path: X-Original-To: apmail-incubator-giraph-user-archive@minotaur.apache.org Delivered-To: apmail-incubator-giraph-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 259319680 for ; Sat, 3 Mar 2012 13:49:51 +0000 (UTC) Received: (qmail 88319 invoked by uid 500); 3 Mar 2012 13:49:51 -0000 Delivered-To: apmail-incubator-giraph-user-archive@incubator.apache.org Received: (qmail 88249 invoked by uid 500); 3 Mar 2012 13:49:50 -0000 Mailing-List: contact giraph-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: giraph-user@incubator.apache.org Delivered-To: mailing list giraph-user@incubator.apache.org Received: (qmail 88231 invoked by uid 99); 3 Mar 2012 13:49:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Mar 2012 13:49:50 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ssc.open@googlemail.com designates 209.85.214.47 as permitted sender) Received: from [209.85.214.47] (HELO mail-bk0-f47.google.com) (209.85.214.47) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Mar 2012 13:49:44 +0000 Received: by bkcjg15 with SMTP id jg15so2335869bkc.6 for ; Sat, 03 Mar 2012 05:49:23 -0800 (PST) Received-SPF: pass (google.com: domain of ssc.open@googlemail.com designates 10.204.154.28 as permitted sender) client-ip=10.204.154.28; Authentication-Results: mr.google.com; spf=pass (google.com: domain of ssc.open@googlemail.com designates 10.204.154.28 as permitted sender) smtp.mail=ssc.open@googlemail.com Received: from mr.google.com ([10.204.154.28]) by 10.204.154.28 with SMTP id m28mr7214198bkw.102.1330782563389 (num_hops = 1); Sat, 03 Mar 2012 05:49:23 -0800 (PST) Received: by 10.204.154.28 with SMTP id m28mr5755669bkw.102.1330782563222; Sat, 03 Mar 2012 05:49:23 -0800 (PST) Received: from [192.168.0.103] (f052132025.adsl.alicedsl.de. [78.52.132.25]) by mx.google.com with ESMTPS id jd17sm14748508bkb.4.2012.03.03.05.49.20 (version=SSLv3 cipher=OTHER); Sat, 03 Mar 2012 05:49:21 -0800 (PST) Message-ID: <4F52215C.3090704@apache.org> Date: Sat, 03 Mar 2012 14:49:16 +0100 From: Sebastian Schelter Reply-To: ssc@apache.org User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.27) Gecko/20120216 Lightning/1.0b2 Thunderbird/3.1.19 MIME-Version: 1.0 To: giraph-user@incubator.apache.org Subject: Re: Error in instantiating custom Vertex class via InternalVertexRunner.run References: In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Benjamin, Does your vertex class have a publicly accessible no-arg constructor? That's implicitly required because each Vertex class implements Writable. If you want to use to have a look at your code, you could maybe put it on github? Best, Sebastian On 02.03.2012 20:51, Benjamin Heitmann wrote: > Hello, > > in the last week I started working with Apache Giraph. My goal is to implement a version of the > spreading activation algorithm (as described on Wikipedia [1] and in this article [2] ). > Using Giraph will hopefully allow scaling for Linked Data/RDF from DBPedia. > > I used the ConnectedComponentsVertex Example (and its UnitTest) as the > starting point for my own Vertex, TextInputFormat, TextOutputFormat and UnitTest (and a class for VertexData/State). > In addition, I ensured that the ConnectedComponentsVertexTest runs successfully, both from the giraph source tree > and from my own project. > > My Vertex class is called SpreadingActivationVertex, and it directly extends BasicVertex, and it has the following signature: > public abstract class SpreadingActivationVertex extends > BasicVertex > As you can see, I need to maintain more then one variable for the state of the vertex, > and I need to pass doubles as messages. > > When I execute my UnitTest, I get the following error: > > 59820 [Thread-4] WARN org.apache.hadoop.mapred.LocalJobRunner - job_local_0001 > java.lang.RuntimeException: java.lang.InstantiationException > at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:115) > at org.apache.giraph.graph.BspUtils.createVertex(BspUtils.java:365) > at ie.deri.uimr.ld_sa.prototyping.giraph.SpreadingActivationTextInputFormat$SpreadingActivationVertexReader.getCurrentVertex(SpreadingActivationTextInputFormat.java:53) > at org.apache.giraph.graph.BspServiceWorker.readVerticesFromInputSplit(BspServiceWorker.java:440) > at org.apache.giraph.graph.BspServiceWorker.loadVerticesFromInputSplit(BspServiceWorker.java:371) > at org.apache.giraph.graph.BspServiceWorker.loadVertices(BspServiceWorker.java:305) > at org.apache.giraph.graph.BspServiceWorker.setup(BspServiceWorker.java:583) > at org.apache.giraph.graph.GraphMapper.setup(GraphMapper.java:474) > at org.apache.giraph.graph.GraphMapper.run(GraphMapper.java:646) > at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:763) > at org.apache.hadoop.mapred.MapTask.run(MapTask.java:369) > at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:210) > Caused by: java.lang.InstantiationException > at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30) > at java.lang.reflect.Constructor.newInstance(Constructor.java:513) > at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:113) > ... 11 more > > > Using the eclipse debugger, I traced it to these lines of code in Hadoop: > > org.apache.hadoop.util.ReflectionUtils, line 113 in newInstance(): > > try { > Constructor meth = (Constructor) CONSTRUCTOR_CACHE.get(theClass); > if (meth == null) { > meth = theClass.getDeclaredConstructor(EMPTY_ARRAY); > meth.setAccessible(true); > CONSTRUCTOR_CACHE.put(theClass, meth); > } > result = meth.newInstance(); // <<<------------ this is the line causing the error > } catch (Exception e) { > throw new RuntimeException(e); > } > > The constructor cache does not contain my vertex class, however the next lines successfully find the right constructor and put it into "meth". > However, the invocation of meth.newInstance() fails with the above error. > > > Did somebody have this error before ? > What did I miss ? > The class itself is successfully found, so it is not an issue of setting some paths. > However getting a newInstance seems to fail for some reason. > > Would it be helpful if I provide the code for my 5 classes somewhere ? If yes, in which way would that be convenient for this mailing list ? > > > > [1] https://en.wikipedia.org/wiki/Spreading_activation > [2] http://linkinghub.elsevier.com/retrieve/pii/0306457387900173 >