Skip to content

Java 11 broken jar file #30

Description

@ipkpjersi

Whenever I use this library in Java 11 to build a jar with Intellij, it says my main class is not found:

When the main class clearly does exist, with the correct packaging:

When using JBCrypt 0.4 instead of this bcrypt library, my jar file works fine, but JBCrypt doesn't support the newer $2y BCrypt version, only $2a.

I worked around this issue by finding a newer JBCrypt fork with $2y support, and I built a jar of it and the jar worked perfectly: https://github.com/Oscil8/jBCrypt/tree/djm-2y-etc an

Activity

  1. patrickfav commented on Feb 2, 2020

    @patrickfav
    Owner

    Hi @ipkpjersi

    Thanks for the bug report.

    I'm a little confused though, it seems the missing class is from your codebase, so I don't see how this library could influence that issue? The only hunch I have is if you use OSGi (I added a feature supporting it by a feature request - but it shouldn't influence non-OSGi)

  2. ipkpjersi commented on Feb 2, 2020

    @ipkpjersi
    Author

    I know, it confused me too. It does say the missing class is from my code-base, but, I did narrow it down to this BCrypt library or the Bytes library that this library depends on. If I remove BCrypt and Bytes and just use JBCrypt, it works fine as it did for months. Just thought I'd give a heads up and report this issue, and maybe see if anyone else was running into it. I'm not using OSGI, but I am using Java 11 which has been known to break some things. I also tried multiple versions of this BCrypt library and of Bytes, and it still did not work.

  3. patrickfav commented on Feb 3, 2020

    @patrickfav
    Owner

    Thanks for telling me, appreciate it. TBF there are not a lot of tests using Java11 so maybe something is broken - I will leave this open and will test in the near future for possible issues.

    Have a good one!

  4. RohanNagar commented on Sep 14, 2020

    @RohanNagar
    Contributor

    For what it's worth I just replaced jbcrypt with this library in my Java 11 application and it's working great!

  5. LionZXY commented on Nov 15, 2020

    @LionZXY

    This problem too :(

  6. patrickfav commented on Nov 29, 2020

    @patrickfav
    Owner

    So unfortunately with this much information I cant really investigate, if one of you have some pointer where to look, or a test case I might be able to fix that.

  7. anc1llary commented on Dec 14, 2020

    @anc1llary

    Hi Patrick,

    What is happening to the individuals for this issue is they did not include your other library, 'Bytes', which is necessary for your Bcrypt library to work. I included the Bytes library with the necessary imports, and this worked successfully. There is no problem here.

    Thanks for your work, it is much appreciated.

  8. HorizonCode commented on Mar 21, 2021

    @HorizonCode

    Also having the same issue with Java8 in IntelliJ.
    added it via maven pom.xml.
    Luyten thows this exception if trying to decompile:

    java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
    	at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
    	at sun.security.util.SignatureFileVerifier.process(Unknown Source)
    	at java.util.jar.JarVerifier.processEntry(Unknown Source)
    	at java.util.jar.JarVerifier.update(Unknown Source)
    	at java.util.jar.JarFile.initializeVerifier(Unknown Source)
    	at java.util.jar.JarFile.getInputStream(Unknown Source)
    	at com.strobel.assembler.metadata.JarTypeLoader.tryLoadType(JarTypeLoader.java:59)
    	at us.deathmarine.luyten.LuytenTypeLoader.tryLoadType(LuytenTypeLoader.java:25)
    	at com.strobel.assembler.metadata.MetadataSystem.resolveType(MetadataSystem.java:125)
    	at com.strobel.assembler.metadata.MetadataSystem.lookupTypeCore(MetadataSystem.java:86)
    	at com.strobel.assembler.metadata.MetadataResolver.lookupType(MetadataResolver.java:46)
    	at us.deathmarine.luyten.Model.openEntryByTreePath(Model.java:338)
    	at us.deathmarine.luyten.Model$TreeListener$1.run(Model.java:266)
    

    Edit:
    This issue seems just to appear if the bytes.jar lib is added to the artifact.
    if i remove it from the export list, the file is fine.
    so as my conclusion: its a issue with the bytes lib dependency.

    Edit 2:
    I think i found the issue, i just deleted the whole META-INF Folder and it works, seems like any of your Hashes are wrong, maybe you should check if there is any issues there.

  9. NathanPB commented on Jun 2, 2021

    @NathanPB

    Just to address, this issue was happening with the Firebase Admin library too. I still don't have any decent workaround

    https://stackoverflow.com/questions/64440041/firebase-admin-sdk-causing-cannot-find-or-load-main-class

    Edit: I downloaded the bytes.jar file and manually checked the hashes in the MANIFEST file and they don't match the .class files ones. Maybe a simple recompile of bytes can solve the entire problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions