Skip to content

No class found with @Document Annotation and attribute collectionName as: User, Android #53

@DzDev202020

Description

@DzDev202020

Hello there,
when I try to create collection this exception is thrown " No class found with @document Annotation and attribute collection Name as: User ", I am sure 100% my code and implementation are correct. If I use it in java code test it work 100%. The problem in reflection does not find the classes at runtime (samsung device). check the code below please:

this is my db init code:

String baseScanPackage = "com.myapp.chat.model";
  String base64EncodedKey = CryptoUtil.generate128BitKey(SomeSecretPassword, SomeUniqueSecreteSalt);
  ICipher cipher = new Default1Cipher(base64EncodedKey);
        jsonDBTemplate = new JsonDBTemplate(dbFilesLocation, baseScanPackage, cipher);

 if (!jsonDBTemplate.collectionExists(User.class))
            jsonDBTemplate.createCollection(User.class);

this is my User class code:

@Document(collection = "User", schemaVersion= "1.0")
public class User implements Serializable {

    @Id
    public String id;
   

    public User() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
   }

the problem is in reflection does not find classes at runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions