Since 4 days ago, in random short periods of time, my deployed application is throwing this error:
org.datanucleus.sco.backed.ArrayList cannot be cast to java.util.Set
We are using GWT 2.4 / Java 1.7 (We recently migrate from 1.6 to 1.7)
It happens when retrieving or persisting an entity with a String set:
import java.util.HashSet;
import java.util.Set;
...
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class DbAccount {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
...
@Persistent
private Set<String> accounts;
...
public DbAccount(SerAccount account) throws Exception {
...
this.accounts= new HashSet<String>();
...
key = KeyFactory.createKey(DbCuentas.class.getSimpleName(), this.id);
}
}
I have checked my entire project for a reference to org.datanucleus.sco.backed.ArrayList and it does not exist.
Any idea?
It may sound stupid, but have you tried to use
List
instead ofSet
?After checking out the docs again, I can't find any example from Google with a
Collection
other thanList
.Reading your issue, it looks like the JPA datanucleus impl is indeed using their own ArrayList implementation whatever you do. I don't know why the problem happens randomly though...