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 <I, V, E, M> signature: 
public abstract class SpreadingActivationVertex extends
BasicVertex<IntWritable, SpreadingActivationStateWritable, NullWritable, 
DoubleWritable>
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<T> meth = (Constructor<T>) 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

Reply via email to