1

I was able to run the demos just fine and build up a graph builder in my unit tests, but now when I deploy this and run on my local server I get NullPointerExceptions on some but not all of the lookups I call.

    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    pc.newProject();
    workspace = pc.getCurrentWorkspace();
    GraphController gc = Lookup.getDefault().lookup(GraphController.class);
    GraphModel model = gc.getModel();

Stack trace below:

Caused by: java.lang.NullPointerException
at com.network.manager.impl.NetworkLayoutManagerImpl.initGraphModel(NetworkLayoutManagerImpl.java:167)
at com.network.manager.impl.NetworkLayoutManagerImpl.convertNetworkToGraph(NetworkLayoutManagerImpl.java:49)
at com.network.manager.impl.NetworkChartManagerImpl.buildNetworkGEXF(NetworkChartManagerImpl.java:61)
at com.network.controller.LoadNetworkControllerImpl.loadNodesAndEdges(LoadNetworkControllerImpl.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
... 139 more

My GraphController "gc" is what is null in this case, though, I'm able to lookup a ProjectController without issue. Out of curiosity, I added the other controllers I needed (AttributeController and ExportController) and printed them out.

(ProjectController --- GraphController --- AttributeController --- ExportController)

System.err.println(pc + " --- " + gc + " --- " + ac + " --- " + ec);

Gives me the following:

org.gephi.project.impl.ProjectControllerImpl@1b819521 --- null --- null --- org.gephi.io.exporter.impl.ExportControllerImpl@3412470a

I'm not too familiar with the Lookup API so this is a complete mystery. I'm running this on Tomcat server. Let me know if any more info is needed.

There is a similar question posted here and the gephi forums with no response.

Streaming Graph to Gephi using toolkit : NullPointerException

https://forum.gephi.org/viewtopic.php?t=1599

Community
  • 1
  • 1
jmcniff
  • 11
  • 3

1 Answers1

1

Lookup depends on files found META-INF/services. It appears that Tomcat isn't finding the ones for GraphController nor AttributeController. There should be files named similarly to how GraphController and AttributeController are imported in your source file.

cs61c.ta
  • 21
  • 2