Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

java.lang.Long cannot be cast to java.lang.String #707

Closed
thallium205 opened this Issue · 21 comments

10 participants

@thallium205

After importing a graph from the Neo4j Graph Importer plugin, I receive this stack trace when exporting the graph to a gexf file:

java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
at org.gephi.graph.dhns.node.NodeDataImpl.getId(NodeDataImpl.java:242)
at org.gephi.io.exporter.plugin.ExporterGEXF.writeNodes(ExporterGEXF.java:371)
at org.gephi.io.exporter.plugin.ExporterGEXF.writeGraph(ExporterGEXF.java:266)
at org.gephi.io.exporter.plugin.ExporterGEXF.execute(ExporterGEXF.java:223)
at org.gephi.io.exporter.impl.ExportControllerImpl.exportFile(ExportControllerImpl.java:131)

Steps to reproduce:

1) Import a graph using the Neo4j Plugin:

final Neo4jImporter importer = new Neo4jImporterImpl(); 
        importer.importDatabase(graphDb, ownerId, TraversalOrder.BREADTH_FIRST, 1, relationshipDescription);        

        // Grab the graph that was loaded from the importer         
        final GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
        final DirectedGraph graph = graphModel.getDirectedGraph();
        AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
        LOG.info("Graph Imported.  Nodes: " + graph.getNodeCount() + " Edges: " + graph.getEdgeCount());

2) Export the graph to a gexf:

final ExportController ec = Lookup.getDefault().lookup(ExportController.class);
final org.gephi.io.exporter.spi.GraphExporter exporter = (org.gephi.io.exporter.spi.GraphExporter) ec.getExporter("gexf");
        exporter.setExportVisible(true); 
        exporter.setWorkspace(graphModel.getWorkspace());
        try 
        {
            ec.exportFile(new File("C:\\graph.gexf"), exporter);
        }

        catch (IOException e)
        {
            LOG.log(Level.SEVERE, "Exporting GEXF Failed.", e);
            return;
        }
@thallium205

A dirty hack that illustrates the problem would be to replace the return value of getId() to:

return String.valueOf(attributes.getValue(PropertiesColumn.NODE_ID.getIndex()));

instead of trying to cast it.

@aishfenton

Bump.

@zanbri

I just upgraded gephi (now v0.8.2) and I receive the same error while importing my neo4j graph through the plugin.

This error didn't arise when importing the exact same graph to the previous version gephi (v0.8.1)..

I'm on OS X.

Thanks in advance for any advice.

@eduramiba
Owner

Hi,
New version of Gephi prevents any plugin or core feature from setting a value with the wrong type for a column.
In this case, Neo4j has always been storing Long values in the node Id column (which has type String).

So, things worked before, but just until a feature like gexf export expected a String from the node Id and a Long was returned instead.

Now this is fixed but Neo4jDelegateProviderImpl still incorrectly expects a Long from the node Id column and causes the exception.

We should be able to fix this using String in Neo4jDelegateProviderImpl (and any possible AttributeValueDelegateProvider should expect String as for an Id).

@eduramiba
Owner

Though having this new prevention mechanism is probably limiting DelegateProviders.
Maybe we can disable it for column with a origin of type delegate and, in Attributes API, make sure that DelegateProviders return a value with the correct type for the column.

@sheymann
Owner

Hi Eduardo, is there a fix released somewhere?

I reproduced the bug by simply loading LesMiserables.gexf, in Gephi, the File > Export > Neo4j, then I try to import the full graph and got the following error:

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
at org.gephi.neo4j.plugin.impl.Neo4jDelegateProviderImpl.getNodeAttributeValue(Neo4jDelegateProviderImpl.java:37)
at org.gephi.data.attributes.AttributeValueImpl.getValue(AttributeValueImpl.java:81)
at org.gephi.data.attributes.AttributeValueImpl.equals(AttributeValueImpl.java:103)
at org.gephi.data.attributes.AttributeRowImpl.setValue(AttributeRowImpl.java:153)
at org.gephi.data.attributes.AttributeRowImpl.setValue(AttributeRowImpl.java:141)
at org.gephi.data.attributes.AttributeRowImpl.setValue(AttributeRowImpl.java:128)
at org.gephi.data.attributes.AttributeRowImpl.setValue(AttributeRowImpl.java:110)
at org.gephi.neo4j.plugin.impl.GraphModelImportConverter.fillGephiNodeDataWithNeoNodeData(GraphModelImportConverter.java:160)
at org.gephi.neo4j.plugin.impl.GraphModelImportConverter.createGephiNodeFromNeoNode(GraphModelImportConverter.java:135)
at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.processNode(Neo4jImporterImpl.java:181)
at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.importNodes(Neo4jImporterImpl.java:175)
at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.importGraph(Neo4jImporterImpl.java:153)
at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.doImport(Neo4jImporterImpl.java:137)
at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.importDatabase(Neo4jImporterImpl.java:131)
at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.importDatabase(Neo4jImporterImpl.java:77)
at org.gephi.desktop.neo4j.Neo4jMenuAction$FullImportMenuAction$1.run(Neo4jMenuAction.java:238)
[catch] at org.gephi.utils.longtask.api.LongTaskExecutor$RunningLongTask.run(LongTaskExecutor.java:251)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

Thanks for the help!

@eduramiba
Owner

Hi,
I just commited a fix for this delegates problem and we should deploy it in the update center for 0.8.2

@eduramiba eduramiba closed this
@vinayprasad

I still find the same issue - I have downloaded gephi 0.8.2-beta (windows) and installed the plugin

I tried importing a example database and received the same error as below

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
at org.gephi.neo4j.plugin.impl.Neo4jDelegateProviderImpl.getNodeAttributeValue(Neo4jDelegateProviderImpl.java:37)
at org.gephi.data.attributes.AttributeValueImpl.getValue(AttributeValueImpl.java:81)
at org.gephi.data.attributes.AttributeRowImpl.getValue(AttributeRowImpl.java:171)
at org.gephi.data.attributes.AttributeRowImpl.getValue(AttributeRowImpl.java:181)
at org.gephi.desktop.datalab.NodeDataTable$AttributeNodeDataColumn.getValueFor(NodeDataTable.java:468)
at org.gephi.desktop.datalab.NodeDataTable$NodeRowModel.getValueFor(NodeDataTable.java:388)
at org.netbeans.swing.outline.ProxyTableModel.getValueAt(ProxyTableModel.java:110)
at org.netbeans.swing.outline.DefaultOutlineModel.getValueAt(DefaultOutlineModel.java:299)
at org.netbeans.swing.etable.ETableColumn.updatePreferredWidth(ETableColumn.java:281)
at org.netbeans.swing.etable.ETable.updatePreferredWidths(ETable.java:1769)
at org.netbeans.swing.etable.ETable.setModel(ETable.java:868)
at org.netbeans.swing.outline.Outline.setModel(Outline.java:634)
at org.gephi.desktop.datalab.NodeDataTable.refreshModel(NodeDataTable.java:258)
[catch] at org.gephi.desktop.datalab.DataTableTopComponent$7.run(DataTableTopComponent.java:437)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:711)
at java.awt.EventQueue.access$000(EventQueue.java:104)
at java.awt.EventQueue$3.run(EventQueue.java:672)
at java.awt.EventQueue$3.run(EventQueue.java:670)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:681)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

@occasl

I'm seeing the exact same issue with gephi 0.8.2-beta (windows Gephi 0.8.2 201210100934) and the installed plugin.

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
    at org.gephi.neo4j.plugin.impl.Neo4jDelegateProviderImpl.getNodeAttributeValue(Neo4jDelegateProviderImpl.java:37)
    at org.gephi.data.attributes.AttributeValueImpl.getValue(AttributeValueImpl.java:81)
    at org.gephi.data.attributes.AttributeValueImpl.equals(AttributeValueImpl.java:103)
    at org.gephi.data.attributes.AttributeRowImpl.setValue(AttributeRowImpl.java:153)
    at org.gephi.data.attributes.AttributeRowImpl.setValue(AttributeRowImpl.java:141)
    at org.gephi.data.attributes.AttributeRowImpl.setValue(AttributeRowImpl.java:128)
    at org.gephi.data.attributes.AttributeRowImpl.setValue(AttributeRowImpl.java:110)
    at org.gephi.neo4j.plugin.impl.GraphModelImportConverter.fillGephiNodeDataWithNeoNodeData(GraphModelImportConverter.java:160)
    at org.gephi.neo4j.plugin.impl.GraphModelImportConverter.createGephiNodeFromNeoNode(GraphModelImportConverter.java:135)
    at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.processNode(Neo4jImporterImpl.java:181)
    at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.importNodes(Neo4jImporterImpl.java:175)
    at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.importGraph(Neo4jImporterImpl.java:153)
    at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.doImport(Neo4jImporterImpl.java:137)
    at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.importDatabase(Neo4jImporterImpl.java:131)
    at org.gephi.neo4j.plugin.impl.Neo4jImporterImpl.importDatabase(Neo4jImporterImpl.java:77)
    at org.gephi.desktop.neo4j.Neo4jMenuAction$FullImportMenuAction$1.run(Neo4jMenuAction.java:238)
[catch] at org.gephi.utils.longtask.api.LongTaskExecutor$RunningLongTask.run(LongTaskExecutor.java:251)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
@pjaol

Same

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
at org.gephi.neo4j.plugin.impl.Neo4jDelegateProviderImpl.getNodeAttributeValue(Neo4jDelegateProviderImpl.java:37)

Product Version: Gephi 0.8.2 201210100934
Neo4j Plugin
Version: 1.0.2 Source: Gephi Thirdparties Plugins

@occasl

Since this issue is closed, I don't think anyone is seeing it. I'm going to open a new issue and please feel free to repost there.

@sheymann
Owner

I reopen it.

@sheymann sheymann reopened this
@eduramiba eduramiba was assigned
@jbilcke
Collaborator

This is the same issue than #740 right?

for which @eduramiba said:

"Sorry, the update is ready but not pushed yet.
You can install it manually with this file https://dl.dropbox.com/u/916968/Gephi/attributes-0.8.2.nbm
This is done in menu Tools - Plugins - Downloaded"

could you please try to download this update?

@pjaol

Yep, that worked

@thallium205

Is there any timeline with getting this included into the Toolkit at the moment?

@sheymann
Owner

Please deploy this fix, many people are waiting for it!

@peterneubauer

Guys, did anything move here? We also would like to upgrade to Neo4j 1.9 after this is deployed.

@sheymann
Owner

Yes it has been deployed for Gephi users, but it still not included in the Gephi Toolkit. You can upgrade to Neo4j right now.

@sheymann sheymann closed this
@peterneubauer

Thanks @sheymann! Is there any screencast or other docs on how to get the Neo4j Plugin to build? Maybe we could have a short skype session? Have NB installed and the code forked, projects set up.

@sheymann
Owner

@peterneubauer you'll find the instructions here:
https://wiki.gephi.org/index.php/Plugin_Quick_Start_(5_minutes)

The code of the plugin is on the repository https://github.com/gephi/gephi-plugins , branch neo4j-plugin.
For any question, please contact @eduramiba instead of me :)

@peterneubauer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.