1

Suddenly getting a 'class_cast' cannot delete error when trying to delete entities since yesterday. What could be causing this? This error is happening via both the Javascript API and the App Services Portal. HELP!!

Error response from javascript API call:

{
  "error": "class_cast",
  "timestamp": 1384530808497,
  "duration": 0,
  "exception": "java.lang.ClassCastException",
  "error_description": "org.usergrid.persistence.cassandra.ConnectedEntityRefImplcannotbecasttoorg.usergrid.persistence.cassandra.ConnectionRefImpl"
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
JBNJ
  • 31
  • 3

2 Answers2

1

As of 2015, connections between entities will no longer prevent their deletion, and this should no longer be a problem.

brandonscript
  • 68,675
  • 32
  • 163
  • 220
0

This exception is thrown when you attempt to delete and entity that has connections to another entity. You must delete the connection before the entity can be deleted.

If you created the connection from this entity, You could try this:

entity.disconnect("<CONNECTIONNAME>", FOREIGN_ENTITY, function(err, data){
  if(err){
    console.error(data.error_description);
  } else {
    entity.destroy(...);
  }
});

And if the connection was made from the connected entity:

FOREIGN_ENTITY.disconnect("<CONNECTIONNAME>", entity, function(err, data){
  if(err){
    console.error(data.error_description);
  } else {
    entity.destroy(...);
  }
});
ryanb
  • 934
  • 7
  • 4