Note that there are some explanatory texts on larger screens.

plurals
  1. POfindAll fails after play morphia is reinitialised
    primarykey
    data
    text
    <p>I have the following class which is persisted into a mongodb using morphia in a play! application. The class resides in a module which is a dependency of another play! application. </p> <p>Its configuration is read from a file and persisted into the db on initial load (if its not already in the db) and then subsequent requests use the db version. </p> <pre><code>@Entity public class Page extends Model { @Id public Long navigationId; // etc ... } </code></pre> <p>The initial load and subsequent query access works ok and i can see the page in mongo: </p> <pre><code>&gt; db.Page.find({_id:20000}) { "_id" : NumberLong(20000), "className" : "models.Page" etc } </code></pre> <p>However if i restart play! or make a code change that results in Morphia being reinitialised (<code>MorphiaPlugin-1.2.4&gt; initialized</code> appears in the logs) i get the following stack trace: </p> <pre><code>Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.google.code.morphia.mapping.MappingException: Error setting value from converter (LongConverter) for models.Page.navigationId to 20000 at com.google.code.morphia.mapping.Mapper.fromDb(Mapper.java:487) at com.google.code.morphia.mapping.Mapper.fromDBObject(Mapper.java:267) at com.google.code.morphia.query.MorphiaIterator.convertItem(MorphiaIterator.java:66) at com.google.code.morphia.query.MorphiaIterator.processItem(MorphiaIterator.java:53) at com.google.code.morphia.query.MorphiaIterator.next(MorphiaIterator.java:48) at com.google.code.morphia.query.QueryImpl.asList(QueryImpl.java:255) at play.modules.morphia.Model$MorphiaQuery.asList(Model.java:1067) at models.Page.findAll(Page.java) at plugins.PageConfigLoadPlugin.loadPersistedPages(PageConfigLoadPlugin.java:62) at plugins.PageConfigLoadPlugin.onApplicationStart(PageConfigLoadPlugin.java:51) at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:425) at play.Play.start(Play.java:495) ... 3 more Caused by: java.lang.RuntimeException: com.google.code.morphia.mapping.MappingException: Error setting value from converter (LongConverter) for models.Page.navigationId to 20000 at com.google.code.morphia.mapping.ValueMapper.fromDBObject(ValueMapper.java:27) at com.google.code.morphia.mapping.Mapper.readMappedField(Mapper.java:501) at com.google.code.morphia.mapping.Mapper.fromDb(Mapper.java:484) ... 14 more Caused by: com.google.code.morphia.mapping.MappingException: Error setting value from converter (LongConverter) for models.Page.navigationId to 20000 at com.google.code.morphia.converters.DefaultConverters.fromDBObject(DefaultConverters.java:133) at com.google.code.morphia.mapping.ValueMapper.fromDBObject(ValueMapper.java:25) ... 16 more </code></pre> <p>If i drop the Collection from mongodb using the command line i can again load and query the Page obejct successfully from my play! web application </p> <pre><code>&gt; db.Page.drop() true </code></pre> <p>As I mentioned, this class is in a module. This problem only happens in one application that the module is a dependency of. The other demo application works fine. </p> <p>any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload