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

NullPointerException with ASMDetector #133

Closed
evernat opened this issue Aug 8, 2019 · 3 comments
Closed

NullPointerException with ASMDetector #133

evernat opened this issue Aug 8, 2019 · 3 comments
Assignees
Milestone

Comments

@evernat
Copy link

evernat commented Aug 8, 2019

With the attached test project, I get the following NPE :

java.lang.ExceptionInInitializerError
        at com.openpojo.reflection.construct.InstanceFactory.wrapAbstractClass(InstanceFactory.java:107)
        at com.openpojo.reflection.construct.InstanceFactory.getInstance(InstanceFactory.java:74)
        at com.openpojo.reflection.construct.InstanceFactory.getLeastCompleteInstance(InstanceFactory.java:103)
        at com.openpojo.random.impl.DefaultRandomGenerator.doGenerate(DefaultRandomGenerator.java:63)
        at com.openpojo.random.RandomFactory.getRandomValue(RandomFactory.java:99)
        at com.openpojo.random.RandomFactory.getRandomValue(RandomFactory.java:107)
        at com.openpojo.validation.test.impl.SetterTester.run(SetterTester.java:45)
        at com.openpojo.validation.utils.ValidationHelper.runValidation(ValidationHelper.java:102)
        at com.openpojo.validation.impl.DefaultValidator.validate(DefaultValidator.java:46)
        at p.TestPojo.testPojoStructureAndBehavior(TestPojo.java:72)
        at ...
Caused by: java.lang.NullPointerException
        at com.openpojo.reflection.service.impl.DefaultPojoClassLookupService.getPojoClass(DefaultPojoClassLookupService.java:64)
        at com.openpojo.reflection.impl.PojoClassFactory.getPojoClass(PojoClassFactory.java:42)
        at com.openpojo.reflection.java.bytecode.asm.ASMDetector.getBundleVersion(ASMDetector.java:58)
        at com.openpojo.reflection.java.bytecode.asm.ASMDetector.getVersion(ASMDetector.java:52)
        at com.openpojo.reflection.java.bytecode.ByteCodeFactory.<clinit>(ByteCodeFactory.java:42)
        ... 40 more

It is reproduced with openpojo 0.8.11 and 0.8.12.
I think it is caused by ff51b7d followed by a64e1c0.
And I don't think that asm version is really needed when asm is not found.

@oshoukry
Copy link
Member

oshoukry commented Aug 9, 2019

Thank you evernat for reporting this issue.

@oshoukry oshoukry added this to the next milestone Aug 9, 2019
@oshoukry oshoukry self-assigned this Aug 9, 2019
@roelver
Copy link

roelver commented Dec 8, 2019

I ran into this same error. Debugging revealed that the ASMDetector.getVersion() could not instantiate org.objectweb.asm.ClassWriter. I added a the asm dependency to my project with a test scope. OpenPojo assumes this dependency as provided. This fixed this error for me.

        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <version>7.1</version>
            <scope>test</scope>
        </dependency>

oshoukry pushed a commit that referenced this issue May 15, 2020
oshoukry added a commit that referenced this issue May 17, 2021
@oshoukry
Copy link
Member

Issue fixed, please see latest release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants