Skip to content
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

ReflectionUtils.readFromNestedJar throwing NPE #1402

Closed
saikrishna-chunchu opened this issue Nov 22, 2019 · 3 comments
Closed

ReflectionUtils.readFromNestedJar throwing NPE #1402

saikrishna-chunchu opened this issue Nov 22, 2019 · 3 comments
Labels
Milestone

Comments

@saikrishna-chunchu
Copy link

I am getting below NPE exception in my project. It looks like, morpia is unable to read the dependency Jars that are part of my project. Unfortunately, I didn't find a decent amount of logs in this section of the code to gather more information.

Failed to initialize mongodb connection
java.lang.NullPointerException: in is null
at java.util.zip.ZipInputStream.(ZipInputStream.java:101)
at java.util.zip.ZipInputStream.(ZipInputStream.java:80)
at java.util.jar.JarInputStream.(JarInputStream.java:76)
at java.util.jar.JarInputStream.(JarInputStream.java:62)
at dev.morphia.utils.ReflectionUtils.readFromNestedJar(ReflectionUtils.java:554)
at dev.morphia.utils.ReflectionUtils.getClasses(ReflectionUtils.java:523)
at dev.morphia.Morphia.mapPackage(Morphia.java:243)

Morphia Version: 1.5.5
Driver Version (mongo-java-driver): 
@evanchooly
Copy link
Member

Can you try with 1.5.8? I want to say I've fixed things in that area lately but I might be confusing things with the 2.0 branch. I'll dig it in to a bit myself, too.

@evanchooly evanchooly added this to the 1.5.9 milestone Nov 25, 2019
@saikrishna-chunchu
Copy link
Author

I am not observing this issue with 1.5.8. Thanks.

What is the root cause of this issue?
The major difference I see between these two releases(in this section of the code ) is, how we read the classes(using classGraph library instead of custom logic).

@evanchooly
Copy link
Member

That was it primarily. The old code had always been fragile and I'd never much cared for it. It'd been the fantasy of a few years now to replace it. That day finally arrived. :) glad to hear it fixed things for you.

@evanchooly evanchooly modified the milestones: 1.5.9, 1.6.0 Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants