-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't run mapper app from within IDE #8
Comments
Mongo-mapper works fine in any IDE, it will be probably problem in your project. I need more info to provide any help - eg. entity you are trying to encode / decode, full stack trace etc. |
I followed these steps
public static void main(String[] args) {
CodecRegistry codecRegistry = CodecRegistries.fromProviders(MongoMapper.getProviders());
MongoClientOptions settings = MongoClientOptions.builder().codecRegistry(codecRegistry).build();
String port = "27017";
MongoClient client = new MongoClient(new ServerAddress("127.0.0.1", Integer.parseInt(port)), settings);
String dbName = "mapper_test" + UUID.randomUUID();
MongoDatabase db = client.getDatabase(dbName);
MongoCollection<TestEntity> collection = db.getCollection("test", TestEntity.class);
collection.drop();
TestEntity entity = new TestEntity();
entity.setChecked(true);
entity.setName("name");
entity.setI(2);
entity.setJ(1);
collection.insertOne(entity);
TestEntity returned = collection.find().first();
Assert.assertEquals(entity.isChecked(), returned.isChecked());
Assert.assertEquals(entity.getName(), returned.getName());
Assert.assertEquals(entity.getI(), returned.getI());
Assert.assertEquals(entity.getJ(), returned.getJ());
}
If I 'mvn clean package' and run again, I get no error. |
I can also confirm this. Running a WAR file on a TOMEE Server and the codec is not found after cleaning the project, but running a Upon @gliviu's observation, I found that Please fix this, as this is a wonderful dependency while waiting for the new Edit: I think it's a bug with the |
@poeia Yeah, that's the cause. I'll add info to the README (copy from classindex) about usage in Eclipse. But probably can't do anything other with it. I'm using Intellij IDEA and everything is working fine.
|
Error:
Seem to be related to missing META-INF/annotations/eu.dozd.mongo.annotation.Entity
The question is how do I convince Eclipse and probably other IDEs to generate that file.
The text was updated successfully, but these errors were encountered: