question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.RuntimeException: Generic TypeVariable not supported!

See original GitHub issue

Using: mongo-java-driver-3.2.2.jar and morphia-1.1.1.jar

The code:

for (UserList userList: userLists){
   DBObject userListDbObj = SingletonLaunchDB.getMorphia().toDBObject(userList);
   SingletonLaunchDB.getMongo().save(userListDbObj);
}

Error trace:

Grave:   java.lang.RuntimeException: Generic TypeVariable not supported!
    at org.mongodb.morphia.mapping.MappedField.toClass(MappedField.java:616)
    at org.mongodb.morphia.mapping.EphemeralMappedField.getSubClass(EphemeralMappedField.java:84)
    at org.mongodb.morphia.mapping.EphemeralMappedField.<init>(EphemeralMappedField.java:39)
    at org.mongodb.morphia.mapping.MappedField.discoverType(MappedField.java:498)
    at org.mongodb.morphia.mapping.MappedField.discover(MappedField.java:465)
    at org.mongodb.morphia.mapping.MappedField.<init>(MappedField.java:93)
    at org.mongodb.morphia.mapping.MappedClass.discover(MappedClass.java:540)
    at org.mongodb.morphia.mapping.MappedClass.<init>(MappedClass.java:124)
    at org.mongodb.morphia.mapping.Mapper.getMappedClass(Mapper.java:431)
    at org.mongodb.morphia.DatastoreImpl.getWriteConcern(DatastoreImpl.java:1632)
    at org.mongodb.morphia.DatastoreImpl.save(DatastoreImpl.java:686)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
evanchoolycommented, Mar 3, 2019

I know this bug is old and the response is probably too late. But this works on master though there are warnings about the T type on the meta field above. Using 1.3.2/1.4.0 should resolve any issues. If not, please file a new issue and I’ll take a look.

0reactions
peter7328matyascommented, Aug 24, 2017

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Map generic list to MongoDB using Morphia - Stack Overflow
Morphia does not support save generics in the DB, so, you can try to make a simple interface and then make all classes...
Read more >
Java Programming Tutorial on Generics
JDK 5 introduces generics, which supports abstraction over types (or parameterized types) on classes and methods. The class or method designers can be...
Read more >
Examining Class Modifiers and Types
This reflection Java tutorial describes using reflection for accessing and manipulating classes, fields, methods, and constructors.
Read more >
Coding Bootcamp: Generics and Threads
Type variable, parameters can be any non-primitive type, e.g., class, interface, array, ... Java supports two different ways of executing threads
Read more >
Contexts and Dependency Injection - Quarkus
However, it's not exactly intuitive. Therefore, a new way was introduced in Quarkus - you can inject a java.util.List annotated with the io.quarkus.arc ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found