Class could not be loaded or is not an entity class
695726Apr 11 2009 — edited Apr 17 2009Hello,
I am using Berkeley DB JE 3.3.75 in a web application. I have a class which extends a Persistent class.
@Entity
public class XMessageInMemoryAdapter extends XMessage implements Serializable {
private static final long serialVersionUID = 1L;
@SecondaryKey(relate=Relationship.MANY_TO_ONE)
private int objectStatus;
}
@Persistent
public class XMessage extends YMessage implements Serializable {
private static final long serialVersionUID = 1L;
@SecondaryKey(relate=Relationship.MANY_TO_ONE)
private String serviceVariant;
}
@Persistent
public abstract class YMessage implements Serializable {
private static final long serialVersionUID = 42L;
@PrimaryKey
private String messageGroupId;
}
But when I try to query the PrimaryKey, an IllegalArgumentException is thrown:
java.lang.IllegalArgumentException: Class could not be loaded or is not an entity class: com.mycompany.common.model.XMessageInMemoryAdapter
at com.sleepycat.persist.impl.Store.checkEntityClass(Store.java:1175)
at com.sleepycat.persist.impl.Store.getPrimaryIndex(Store.java:313)
at com.sleepycat.persist.EntityStore.getPrimaryIndex(EntityStore.java:257)
at com.mycompany.common.memorydb.impl.StoreRefImpl.queryPrimaryIndex(StoreRefImpl.java:49)
at com.mycompany.common.memorydb.dao.MessageDao.init(MessageDao.java:67)
And here is the MessageDao ve StoreRefImpl ( I deleted irrelevant parts )
public class MessageDao {
protected void init() {
primaryKey = this.store.queryPrimaryIndex(String.class, XMessageInMemoryAdapter.class);
}
}
public class StoreRefImpl {
public PK queryPrimaryIndex(Class<?> indexClass, Class<?> objectClass) {
try {
PrimaryIndex index = this.store.getPrimaryIndex(indexClass, objectClass); // this is where the exception is thrown
return new PKImpl(index);
} catch (DatabaseException e) {
throw new DBException(e);
}
}
}
Everything working nice in my local machine but when we deploy the application on test server we keep getting this exception.
Thank you for your help.