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 5880E92BA for ; Fri, 2 Mar 2012 23:15:25 +0000 (UTC) Received: (qmail 58355 invoked by uid 500); 2 Mar 2012 23:15:25 -0000 Delivered-To: apmail-incubator-giraph-user-archive@incubator.apache.org Received: (qmail 58323 invoked by uid 500); 2 Mar 2012 23:15:25 -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 58315 invoked by uid 99); 2 Mar 2012 23:15:25 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 23:15:25 +0000 Received: from localhost (HELO achingmbp15.local) (127.0.0.1) (smtp-auth username aching, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 23:15:24 +0000 Message-ID: <4F51549C.4090409@apache.org> Date: Fri, 02 Mar 2012 15:15:40 -0800 From: Avery Ching User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 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: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit If I'm reading this right, you're using a public abstract class for the vertex. The vertex class must be instantiable and cannot be abstract. Hope that helps, Avery On 3/2/12 11:51 AM, 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 >