2016-09-09 2 views
1

Morphia를 사용하여 POJO를 저장하려고했습니다.Morphia가 기본 개체를 저장할 때 내부 예외를 throw합니다.

final Morphia morphia = new Morphia(); 

morphia.mapPackage("entities.users"); 

final Datastore datastore = morphia.createDatastore(new MongoClient(), "test_table"); 
datastore.ensureIndexes(); 
datastore.save(user); 

그러나, 이상한 일이 datastore.ensureIndexes()은 모르핀에 의존하는 이상, 내부 예외를 던지고 있다는 것입니다 : I've은 간단하다 다음과 같은 코드를 가지고 일부에서

WARNING: Parameterized types are treated as untyped Objects. See field 'assertionLock' on class java.lang.ClassLoader 
org.mongodb.morphia.mapping.MappingException: Cannot use non-static inner class: class java.security.ProtectionDomain$Key. Please make static. 
    at org.mongodb.morphia.mapping.MappedClass.basicValidate(MappedClass.java:495) 
    at org.mongodb.morphia.mapping.MappedClass.<init>(MappedClass.java:123) 
    at org.mongodb.morphia.mapping.Mapper.getMappedClass(Mapper.java:451) 
    at org.mongodb.morphia.DatastoreImpl.processEmbeddedAnnotations(DatastoreImpl.java:1545) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:1185) 
    at org.mongodb.morphia.DatastoreImpl.processEmbeddedAnnotations(DatastoreImpl.java:1545) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:1185) 
    at org.mongodb.morphia.DatastoreImpl.processEmbeddedAnnotations(DatastoreImpl.java:1545) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:1185) 
    at org.mongodb.morphia.DatastoreImpl.processEmbeddedAnnotations(DatastoreImpl.java:1545) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:1185) 
    at org.mongodb.morphia.DatastoreImpl.processEmbeddedAnnotations(DatastoreImpl.java:1545) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:1185) 
    at org.mongodb.morphia.DatastoreImpl.processEmbeddedAnnotations(DatastoreImpl.java:1545) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:1185) 
    at org.mongodb.morphia.DatastoreImpl.processEmbeddedAnnotations(DatastoreImpl.java:1545) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:1185) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:1167) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:1189) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:274) 
    at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:266) 
    at repositories.UsersRepository.createUser(UsersRepository.java:65) 
    at repositories.UsersRepository.main(UsersRepository.java:101) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) 

Process finished with exit code 0 

답변

0

Morphia 나 운전자가하는 법을 모르는 java.security.ProtectionDomain$Key 인스턴스를 직렬화하려고합니다. 해당 유형을 관리하려면 Converter을 작성해야합니다.